Saving state and reloading at arbitrary timepoint
Saving state and reloading at arbitrary timepoint
Hi,
I'm looking to somehow bookmark a table state. Let me try to explain...
Using datatables 1.10 I'm saving state (which by default goes to localStorage). I have a button which issues an ajax POST of the localStorage to my "bookmarking" server, persisting the state in a postgres database. I have another button which GETs the persisted state from the database, returned as JSON. I'm hoping to re-draw the table using the state object returned from the database. Is this possible? If so any general pointers would be appreciated.
(A response to a comment by Alverson in this discussion suggested to me that it is not, but I wasn't sure and I'm holding out hope :))
Answers
I got something working. Basically, I save a table state to my bookmarking app. To reload the table state I pull it from the server, write it to the browser's localStorage and then reload the page using "location.reload();" and its previous state is redrawn by DataTables. If there's another way of achieving this, I'd be glad to hear it.