0

htmlデータ

<div id="flexdiv" class="resizable-ui">
<div> etc layer .. </div>

<table class='flexme1'>
...
</table>

</div>

jQueryデータ

    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});
        });

それは機能していません。何が問題なのかわかりません。角度を助けてください!!!!!!!!!!!!!!! お願いします..

4

1 に答える 1

0

だから私はあなたがdivとテーブル要素の両方をサイズ変更できるコードを書いた:

<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 のサイズに依存するテーブルを作成することもできます。基本的なコアは、私が提供したものと同じままです。

デモはこちら

于 2014-08-27T04:50:45.847 に答える