I am using the latest DataTables, however I have not updated my code to use the new API... I am still using the Hungarian notation! I don't mind if answers use the new methods and notation, but I just wanted to frame the context of the question. ;)
I have the potential on a page to have several DataTables, each of them updating every X seconds. For this reason, I basically keep track of my own array of DataTables so that I can call fnDraw on them at the polling interval.
So, on initialize I do something like this:
pollObj[0] = $('#myTable').dataTable(options);
Then every X seconds, the table gets redrawn thus:
pollObj[0].fnDraw(false)
The problem is that since the initialization parameters are cached, the DataTable is losing track of its iDisplayStart and setting it back to 0 each time. If I'm at page 5 when the polling interval comes around again, it redraws the table back at page 1.
How can I get it to remember my iDisplayStart? In other words, how can I modify the pollObj[i] after a page change (draw) so that the next time fnDraw is called on it, the new value gets used? I found the fnSettings method, but there doesn't seem to be a setter. Or is it just fnSettings()._iDisplayStart = x?
I experimented with _iDisplayStart = x, but I just sort of shoved it into the polling method rather than the Ajax success callback... maybe it's "overriding" it because of some sort of race condition I haven't sussed out yet... maybe if I do it in the success callback it'll work...?
Any pointers?