Hi,
First of all, I wanted to thank you for your excellent work on this library. I've just started using DataTables, and I really love it. It's obvious that you've put an incredible amount of effort into this library.
Here is my question. Is it possible to do something like this: var data = api.getSaveStateData(); This would return an object with all the relevant data to save into localStorage (or where ever).
On a page with multiple widgets, it would be nice, to store all the data for the page in one localStorage key (rather than 1 key per widget).
Then, on page load, you would pass the relevant data into the widgets as initialization options.
I think the main benefit is getting the page save / load logic centralized in one place rather than spread around. Particularly if your state saving strategy involves AJAX, then it seems like it would be much better to save / load the page state with one request, rather than one request per widget. Another benefit to storing all the data in one key is a unified expiration time for all the page data, so that you don't end up loading a partially-initialized page where some widgets' data has expired and others not.
Is this something that is already possible, or maybe an easy change?
Thank you,
James
First of all, I wanted to thank you for your excellent work on this library. I've just started using DataTables, and I really love it. It's obvious that you've put an incredible amount of effort into this library.
Here is my question. Is it possible to do something like this: var data = api.getSaveStateData(); This would return an object with all the relevant data to save into localStorage (or where ever).
On a page with multiple widgets, it would be nice, to store all the data for the page in one localStorage key (rather than 1 key per widget).
// Save state of all widgets on page close var pagedata = { widget1: widget1.getSaveStateData(), // Some widget widget2: widget2.getSaveStateData(), // Some other widget dataTable: api.getSaveStateData() // A DataTable }; localStorage["mykey"] = JSON.stringify(pagedata); // Save it all in one key
Then, on page load, you would pass the relevant data into the widgets as initialization options.
I think the main benefit is getting the page save / load logic centralized in one place rather than spread around. Particularly if your state saving strategy involves AJAX, then it seems like it would be much better to save / load the page state with one request, rather than one request per widget. Another benefit to storing all the data in one key is a unified expiration time for all the page data, so that you don't end up loading a partially-initialized page where some widgets' data has expired and others not.
Is this something that is already possible, or maybe an easy change?
Thank you,
James