Restoring table state based on overwriting localStorage key doesn't work
Restoring table state based on overwriting localStorage key doesn't work
Hi,
I'm trying to implement functionality of restoring dataTables state on load of a page based on the state data which I store in the DB.
The general idea of mine is to access the appropriate localStorage key and write the serialized table state data (fetched from DB) before specified table instance is initialized.
I've set up "stateSaveCallback" and "stateLoadCallback" callbacks to read/write from/to correct key.
I cannot figure out why between initial stateLoadCallback call at table initialization process and final stateSavecallback call at the end of that process the data saved to localStorage differs significantly (in terms of column visibility) from the data which was loaded.
The state loading works fine when i don't try to mess with the contents of localStorage and all column visibility is preserved.
But somehow the state which i load is ignored by dataTable and modified along the way of loading state procedure.
Can you give me some pointers how can I workaround this issue ?
I would appreciate any help - thanks in advance.
Debug toolbar link: https://debug.datatables.net/idehez
(second table: #dataTable)