StateRestore states being overwritten by second table on same page/path
StateRestore states being overwritten by second table on same page/path
Link to test case:
https://jsfiddle.net/6mzwosvd/6/
Description of problem:
State save does not appear to be using the table dom ID (my best guess) to uniquely save states used in stateRestore across different tables on the same page. When two tables are on a page, changing the state of table 2 (creating/deleting/updating) overwrites the available states in table 1 despite them having different dom id's (and vice versa). I tried to override the state save/load callbacks and specifying the keys to ensure they were unique but it didn't seem to have an effect. I also tried using session storage by setting the saveDuration to -1
but no change.
To reproduce just reload the page after creating a new date (or deleting one) and of course leave snippet as is else page path changes and all states will be lost.
This question has accepted answers - jump to:
Answers
Hi @ctml ,
Thanks for pointing this out. I've raised an issue internally (DD-2423 for my reference) and will report back here when there is an update.
Thanks,
Sandy
Thanks @sandy , if you happen to be aware of any workarounds in the meantime please let me know Sadly I've had to remove the extension for now as most of my pages have two tables.
Hi @ctml ,
That should be the issue fixed now. This will be available in the next StateRestore release which we hope will be in the next few weeks. Until then you can access the fix from the nightly builds.
Thanks,
Sandy
Thanks @sandy , you're a rock star!
@sandy I tried nightly and still encounter the issue. Below is an updated fiddle with nightly js for state restore.
https://jsfiddle.net/1gfbojtd/
PS: The stateRestore header is labeled as "Select" (duplicate) in nightly downloads and the second js link is not provided for the styling options unlike other extensions.
https://datatables.net/download/nightly
Hi @ctml ,
Sorry but it looks to be working for me!
You might have to break the cache on the script tag that pulls in the nightly build - try adding
?ausdbvcaubv
to the end of the url.Thanks,
Sandy
That seems to have helped, however there is still a conflict in the individual states themselves.
Hi @sandy, here is an updated fiddle using the 1.1 release. Thanks
https://jsfiddle.net/kr1p037u/
Hi @ctml ,
Thanks for pointing this out! I've reopened the issue I mentioned above and will report back here when there is an update.
Thanks,
Sandy
Hi @ctml ,
That should be the issue fixed now as you can see at this example. This will be available in the next StateRestore release which we hope will be in the next few weeks. Until then you can access the fix from the nightly builds.
Thanks,
Sandy
Thank you @sandy! Confirmed working with latest nightly, cheers.