auto fill lines on table size change

auto fill lines on table size change

williamwilliam Posts: 3Questions: 0Answers: 0
edited July 2012 in General
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();
});

Replies

  • tja824tja824 Posts: 6Questions: 0Answers: 0
    I am interested in this solution as well, to be used in conjunction with paging.

    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.
This discussion has been closed.