Datatables with Scroller and Server-side Processing with deferLoading still loads data on table init
Datatables with Scroller and Server-side Processing with deferLoading still loads data on table init
Hi,
I am using Datatables 1.10.11 with Scroller 1.4.1 and loading the data via server-side processing. Since I want my users to only see rows when they explicitly enter a search query, I am trying to use the deferLoading option. This works fine except when I'm using Scroller. It seems that Scroller triggers a draw of the table on initialisation, which triggers a load of the data on the server.
I made a JsFiddle demonstrating the issue: https://jsfiddle.net/jbrichau/gdLr4vmp/
In the fiddle, you see that the table is immediately filled with data. However, it should only be filled when you hit the reload button.
I also started fiddling around in the Scroller source, and noticed how a call to fnMeasure
on init triggers a draw of the table. Changing the code on this line: https://github.com/DataTables/Scroller/blob/master/js/dataTables.scroller.js#L590 to that.fnMeasure(false);
fixed my problem. However, I'm unsure of this is the way to go or not.
thanks for any help
Johan
Answers
I am experiencing the same issue. Did you find anything else out about this?
I am using the changes I mentioned and they are working fine.
Unfortunately, it's not being picked up in the main version. Understandably, the forum is full of requests.
I fixed this issue. The following fix has scroller check if
deferLoading
is set before trying to redraw the table on initialization.$(this.s.dt.nTable).one( 'init.dt', function () {
is written.