0
我在我的應用程序中有多個數據表的多個選項卡。什麼是在window.resize上動態設置數據表高度的最佳方法?
我想找出一種方法來調整基於屏幕大小的數據表的高度。
我嘗試了下面的函數,但它似乎並沒有增加調整窗口大小時數據表的高度。任何建議將會非常有幫助?
var calcDataTableHeight = function(percentageValue) {
return $(window).height()*(percentageValue)/100;
};
$(window).resize(function() {
var table = $.fn.dataTable.fnTables(true);
if (table.length > 0) {
for(var i=0;i<table.length;i++){
$(table[i]).dataTable().css({ height: $(table[i]).dataTable().parent().height() });
$(table[i]).dataTable().fnAdjustColumnSizing();
}
}
}
});
哪來calcDataTableHeight? – zanedev
var calcDataTableHeight = function(percentageValue){ return $(window).height()*(percentValue)/ 100; }; – Learner