html数据
<div id="flexdiv" class="resizable-ui">
<div> etc layer .. </div>
<table class='flexme1'>
...
</table>
</div>
var width = $(div).width(),
height = $(div).height()-100;
$('.flexme1').flexigrid({
width: width,
height: height,
resizable: false,
singleSelect: true});
$(div).resize(function() {
var width = $(div).width(),
height = $(div).height() -20;
$('.flexme1').flexigrid({height:height,width:width,striped:false});
});
它不起作用 我不知道这是什么问题 帮我角度!!!!!!!!!!!!!!! PLZ ..
答案 0 :(得分:0)
所以我编写了代码,你可以调整div和table元素的大小:
<div id="flexdiv" class="resizable-ui" style="border: 1px solid">
<div> etc layer .. </div>
<table id="table1" class='flexme1' style="border: 2px dotted; width:200px; height:200px">
</table>
</div>
Javascript:
var div = document.getElementById("flexdiv");
var width = $(div).width(),
height = $(div).height();
alert("Div-OldHeight: "+ height);
alert("Div-OldWidth: "+ width);
var newHeight = "600px";
var newWidth = "400px";
div.style.height = newHeight;
div.style.width = newWidth;
alert("Div-NewHeight: "+ newHeight);
alert("Div-NewWidth: "+ newWidth);
var table = document.getElementById("table1");
width = $(table).width(),
height = $(table).height();
alert("Table-OldHeight: "+ height);
alert("Table-OldWidth: "+ width);
var newHeight = "100px";
var newWidth = "100px";
table.style.height = newHeight;
table.style.width = newWidth;
alert("Table-NewHeight: "+ newHeight);
alert("Table-NewWidth: "+ newWidth);
我已将新的宽度和高度放在变量中,您可以根据需要更改它们,希望您将了解如何执行此操作。您还可以根据div的大小制作表格,基本核心将保持与我提供的相同...
<强> See the demo here 强>