How to keep the sorting with refreshed data
How to keep the sorting with refreshed data
Hi,
I want to use DataTables to provide my user with sort/filter capability.
The data, though, is refreshed every 5 seconds. I do that using jQuery's load() to load a file that contains the table rows and injects it into the DOM. The problem is that it loses the sorting/filtering done by the user.
How do I do that? Would it help if the file I load is a JSON object instead?
(Note: the data that I load every 5 seconds is generated from an external system as HTML, but I can have it generate a JSON object instead).
Thanks!
Answers
Have you tried stateSave?
https://datatables.net/reference/option/stateSave
I tried stateSave and it didn't do the trick, but the following configuration parameter did: