@colin stateRestore.saveState.length = false is working however paging is still not working.
I have the following configuration and the saved state includes the page I am on which we really don't want. In fact I don't know how this will work if the number of pages changes. If I save a state on page 5 and then the data becomes a smaller set with only 3 pages how can state restore return to page 5 which no longer exists.
I think the paging=false is only broken for ajax. I don't understand why so many of these features depend on if you are getting your state data from ajax or memory. That shouldn't affect the logic but for some reason it does.
Anyway should I start a new thread on the paging issue? It is mentioned in this thread but I don't think it was addressed. You opened this ticket in regard to paging DD-2493 based on your comment above.
I've updated a previous version of your test case and it seems to be working fine for me. Could you please let me know how you can reproduce any errors that you are seeing there?
@sandy I just noticed that even in your example the State becomes inactive when you change pages. So that is one symptom perhaps you can chase down.
To recreate in your example http://live.datatables.net/rivurece/1/edit
1) Switch to page 4
2) Create view named "Page 4 Test"
3) Notice that the "Page 4 Test" is active in the menu (green)
4) switch to page 1
5) Notice that "Page 4 Test" is no longer active in the menu (not green)
This part is different for my code vs the test code
6) select "Page 4 Test" to activate it.
7) Notice the view switches to Page 1 (in my code it switches to page 4)
8) Notice the view is NOT active even though you just selected it (In my code it is active since we are on page 4)
9) Switch manually to page 4
10) Notice the View is now active (green) again in the menu.
PS: I got your example working in Chrome by deleting my IDBStore database. I didn't know exactly how that worked so had to chase it down a bit.
@sandy Update, I found my issue causing the page to be restored. I had some remnants of stateSaveCallback and stateLoadCallback which should have been removed. Sorry about that, but there is still the bug I mention in my last post.
My local code tests now match my last post in steps 6-10. So it appears the page is NOT being restored however the page is preventing "Active State" from working correctly.
Another test I did to prove this is as follows.
1) Go to page 1 and save state as "Page 1"
2) Go to page 4 and save state as "Page 4"
3) Select "Page 4" saved state
4) Note that "Page 1" is active
5) Select Page 4, NOTE "Now Page 4 is active"
So the remaining bug is when "paging" is set to false, paging is still be used to determine if a state is active or not.
Any idea when the current fixes will be released? I have a pending release of my system and trying to decide if I need to pull from nightly or not.
The length and paging fixes are important since states saved without them will remain broken even after the fix unless deleted and recreated. This last issue is less critical since it is just misinformation to the user and when fixes shouldn’t require replacing the saves states hopefully.
I've made a simple test case that doesn't use IDB store and it works fine there.
I'm not an expert on IDBStore, but when I update the dbVersion and follow the steps you list above I also do not see an issue - see here. I'm unable to delete certain states when I do this, but I think this is down to the IDBStore configuration. This suggests to me that the problems that you are seeing have been resolved and are now down to something that IDBStore is doing?
Can you try stripping IDBStore completely so it is fresh and make a brand new one? Does it work for you then?
Same test steps
1) Go to page 1 and save state as "Page 1"
2) Go to page 4 and save state as "Page 4"
3) Select "Page 4" saved state
4) Note that "Page 1" is active
5) Select Page 4, NOTE "Now Page 4 is active"
More steps to prove the point
6) Select Page 3, No States are active
7) Select Page 1, Now "Page 1" state is active and "Page 4" state is inactive
8) Select Page 4, Now "Page 4" state is active and "Page 1" state is inactive.
@sandy I think I found the reason yours worked. You need to include search builder for the issue to happen. This is basically your test case with search builder added and not it has same problem as my test case.
Test
1) Create State "State 1" (initial load so page 1)
2) Switch to Page 4 (State becomes inactive), Create State "State 2"
3) Switch to page 1 ("State 1" becomes active, "State 2" becomes inactive)
...
Delete states
Comment out SearchBuilder
Repeat test and things work now.
Thanks for doing the work to track down the issue further, something definitely isn't right there. I've raised an issue internally (DD-2531 for my reference) and will report back here when there is an update.
That should hopefully be the issue fixed now. I've added the latest nightly to the above simplified example. I've also updated the IDB store example and it seems to be working there - not sure how to get rid of the old states though once I update the version number!
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.
Answers
@colin stateRestore.saveState.length = false is working however paging is still not working.
I have the following configuration and the saved state includes the page I am on which we really don't want. In fact I don't know how this will work if the number of pages changes. If I save a state on page 5 and then the data becomes a smaller set with only 3 pages how can state restore return to page 5 which no longer exists.
I think the paging=false is only broken for ajax. I don't understand why so many of these features depend on if you are getting your state data from ajax or memory. That shouldn't affect the logic but for some reason it does.
Anyway should I start a new thread on the paging issue? It is mentioned in this thread but I don't think it was addressed. You opened this ticket in regard to paging DD-2493 based on your comment above.
This is my configuration.
Thanks. Sandy is back in again tomorrow, he'll be better placed to diagnose then,
Colin
@colin Thanks for the update.
Hi @desperado ,
I've updated a previous version of your test case and it seems to be working fine for me. Could you please let me know how you can reproduce any errors that you are seeing there?
Thanks,
Sandy
@sandy when I run your test case in chrome (Version 99.0.4844.84 (Official Build) (x86_64)) it fails to start with the following error.
Uncaught Error: The version number provided is lower than the existing one.
at q.<anonymous> (idbstore.min.js:12:158)
In mozilla it is working.
When I use nightly for Datatables and StateRestore in my application I am still seeing it fail. I don't understand why yet.
I can see that I am using nightly.
Paging is clearly set to false.
But when I save state while on page 4. If I switch to page 1 the state becomes inactive. If I activate the state it switches to page 4.
Do you have any suggestions on how I can debug this?
The saved state looks like this stored in my DB
@sandy I just noticed that even in your example the State becomes inactive when you change pages. So that is one symptom perhaps you can chase down.
To recreate in your example http://live.datatables.net/rivurece/1/edit
1) Switch to page 4
2) Create view named "Page 4 Test"
3) Notice that the "Page 4 Test" is active in the menu (green)
4) switch to page 1
5) Notice that "Page 4 Test" is no longer active in the menu (not green)
This part is different for my code vs the test code
6) select "Page 4 Test" to activate it.
7) Notice the view switches to Page 1 (in my code it switches to page 4)
8) Notice the view is NOT active even though you just selected it (In my code it is active since we are on page 4)
9) Switch manually to page 4
10) Notice the View is now active (green) again in the menu.
PS: I got your example working in Chrome by deleting my IDBStore database. I didn't know exactly how that worked so had to chase it down a bit.
@sandy Update, I found my issue causing the page to be restored. I had some remnants of stateSaveCallback and stateLoadCallback which should have been removed. Sorry about that, but there is still the bug I mention in my last post.
My local code tests now match my last post in steps 6-10. So it appears the page is NOT being restored however the page is preventing "Active State" from working correctly.
Another test I did to prove this is as follows.
1) Go to page 1 and save state as "Page 1"
2) Go to page 4 and save state as "Page 4"
3) Select "Page 4" saved state
4) Note that "Page 1" is active
5) Select Page 4, NOTE "Now Page 4 is active"
So the remaining bug is when "paging" is set to false, paging is still be used to determine if a state is active or not.
I'll add this to Sandy's list for when he's back in, but it won't be until next week I'm afraid,
Colin
@colin thanks for letting me know.
Any idea when the current fixes will be released? I have a pending release of my system and trying to decide if I need to pull from nightly or not.
The length and paging fixes are important since states saved without them will remain broken even after the fix unless deleted and recreated. This last issue is less critical since it is just misinformation to the user and when fixes shouldn’t require replacing the saves states hopefully.
Hi @desperado ,
I've made a simple test case that doesn't use IDB store and it works fine there.
I'm not an expert on IDBStore, but when I update the dbVersion and follow the steps you list above I also do not see an issue - see here. I'm unable to delete certain states when I do this, but I think this is down to the IDBStore configuration. This suggests to me that the problems that you are seeing have been resolved and are now down to something that IDBStore is doing?
Can you try stripping IDBStore completely so it is fresh and make a brand new one? Does it work for you then?
Thanks,
Sandy
@sandy
This test case fails without ajax or IDB.
http://live.datatables.net/lutozipi/1/edit?js,output
Same test steps
1) Go to page 1 and save state as "Page 1"
2) Go to page 4 and save state as "Page 4"
3) Select "Page 4" saved state
4) Note that "Page 1" is active
5) Select Page 4, NOTE "Now Page 4 is active"
More steps to prove the point
6) Select Page 3, No States are active
7) Select Page 1, Now "Page 1" state is active and "Page 4" state is inactive
8) Select Page 4, Now "Page 4" state is active and "Page 1" state is inactive.
@sandy Sorry my last example still had some IDB code, it wasn't in use but it was there so might confuse the case.
Here is an example without any IDB reference and not using Ajax. This too has the issue.
http://live.datatables.net/zadagasu/1/
I am trying now to test why your test case doesn't fail and will report back if I can figure it out.
Now I am getting message that the link I provided was created anonymously so just in case here is another copy from my account.
http://live.datatables.net/loluseri/1/edit
@sandy I think I found the reason yours worked. You need to include search builder for the issue to happen. This is basically your test case with search builder added and not it has same problem as my test case.
http://live.datatables.net/jizatane/1/edit
Test
1) Create State "State 1" (initial load so page 1)
2) Switch to Page 4 (State becomes inactive), Create State "State 2"
3) Switch to page 1 ("State 1" becomes active, "State 2" becomes inactive)
...
Delete states
Comment out SearchBuilder
Repeat test and things work now.
That's good info, thanks for delving into it. We'll take a nose and report back,
Colin
Hi @desperado ,
Thanks for doing the work to track down the issue further, something definitely isn't right there. I've raised an issue internally (DD-2531 for my reference) and will report back here when there is an update.
Thanks,
Sandy
@sandy no problem sorry I had so much trouble tracking this one down I appreciate your effort!
FYI stateRestore and searchBuilder are in my production system now so I am all in LOL
Cheers
Hi @desperado ,
That should hopefully be the issue fixed now. I've added the latest nightly to the above simplified example. I've also updated the IDB store example and it seems to be working there - not sure how to get rid of the old states though once I update the version number!
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
@sandy Thanks! I will test it out and let you know.
To clear IDB store in chrome click on storage, clear site data (while on the live.datatables.net page). I assume other browsers are similar.