auto fill lines on table size change
auto fill lines on table size change
Currently have a table auto resizing nicely however cannot get the number of rows to dynamically change nicely based upon the window height. Wondering if there is a command to auto fill the number of lines based upon the window height? you help is much appreciated.
$(window).resize(function() {
console.log($(window).height());
$('.dataTables_scrollBody').css('height', ($(window).height() - 160));
table = $('#example').dataTable();
settings = table.fnSettings();
console.log('old:' + settings.oScroll.sY);
console.log('new:' + settings.oScroll.sY);
var oSettings = oTable.fnSettings();
oSettings._iDisplayLength = ($(window).height() - 10); // not playing nice.
oTable.fnDraw();
});
$(window).resize(function() {
console.log($(window).height());
$('.dataTables_scrollBody').css('height', ($(window).height() - 160));
table = $('#example').dataTable();
settings = table.fnSettings();
console.log('old:' + settings.oScroll.sY);
console.log('new:' + settings.oScroll.sY);
var oSettings = oTable.fnSettings();
oSettings._iDisplayLength = ($(window).height() - 10); // not playing nice.
oTable.fnDraw();
});
This discussion has been closed.
Replies
I have a dataTable I am displaying inside a div that is sized when the page is drawn. Depending on the size of the browser window, this means that the div could have room for 20 table rows, or it could have room for 40. I'd like to dynamically set the paging size (and the number of rows displayed) to maximize the space in my div.