Datatable+Scroller, empty rows on display & wrong row count, when reducing table body height
Datatable+Scroller, empty rows on display & wrong row count, when reducing table body height
...and small scroller.displayBuffer=2, and want to retain the same first visible row
-> certainly important, because I switch between 3 visible lines and 14, and I didn't noticed this problem before reducing the displayBuffer.
The height siwtch is done throught a winow.resize event handler, which re-compute the wanted datable body height (please note, this it entirely outside this question : it may be helpfull to have a function to set & modify the wanted "full datatable" height : eg, I have XXXpx to display the buttons+search+datatable(header+body+footer)+bottom infos+ ?other datable features?)
I'm using the latest release :
//cdn.datatables.net/u/dt/dt-1.10.12,b-1.2.1,b-html5-1.2.1,sc-1.4.2,se-1.2.0/datatables.min.js
on window.resize, I update the datatable body height, to fit correctly the window height :
$(MY_TABLE+' .dataTables_scrollBody').css( 'height', THE_NEW_HEIGHT);
var dt = $(MY_TABLE+'_table').DataTable({bRetrieve:true});
dt.scroller.measure(); // without this, maximizing shows empty rows
dt.draw("page"); // I want that the table still displays the currently visible first line
This way :
- when the allowed height grows => no problem
- when you start with full height, then scroll a little, then reduce the allowed height => the problem appears
"full-hold" didn't work either, and it's not that I really needs (the datatable's data didn't change).
I can provides a test case, but not immediately.
Regards,
Gérald
Answers
Hi,
Here is a jsfiddle wich partially shows the bug : https://jsfiddle.net/wm76spy3/9/
I cannot reproduce the pagination information problem, only the missing rows.
Expected result : rows 7 to 9 should be visible, and the pagination should reflect that.
Test results are a little different across browsers :
firefox 47 :
* rows 7 & 8 are visible, but not 9
* pagination information = ok for me : "Showing 7 to 10 of 101 entries"
chrome 51.0.2704.84 :
* no row visible
* pagination information = ok for me : "Showing 7 to 9 of 101 entries"
Regards,
Gérald
Am I the only one with this bug? Implying something wrong in my code?
Or this is not a priority?