PageLength and SaveState correlation
PageLength and SaveState correlation

Link to test case:
It seems that when SaveState is enabled, changing PageLength once it loads is impacted. For example, I'm doing some verifications on an example I set page length to 5 with savestate set to true. Later on, I change it to 15 and I can't see things changing as Savestate prevents the change to show.
https://codepen.io/MadBoyEvo/pen/gOMYeeE
Is this by design or could this be somehow workaround? This seems to "live" for a long time, browser closing and so on.
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
This question has an accepted answers - jump to answer
Answers
I might be misunderstanding the problem but the tables in your example have only 4 rows. Changing to 15 rows won't change anything with the table display. I made the following chages to one of your tables and can change the page length:
But I can only change it from 1 to 4. Can't save the changes as I don't have a codepen account.
Kevin
It's just minified example. Length menu doesn't matter. PageLength does. If you play with the file locally (save as .HTML) and change from 5 to 1 and save, change then save and refresh. Nothing happens when save state is on.
Still not seeing the problem. I copied your code here:
http://live.datatables.net/lupugila/1/edit
I added
2
to the lengthMenu of the first table. And changed"stateSave": false,
to"stateSave": true,
in the second table.I can change the page length using the button reload the page and it shows the page length I changed to. In the first table I can set it to a page length of 2 and go to page 2. Reload the page and it shows a page length of 2 and the table displays page 2.
Sorry, I'm not clear how you are doing this. I still may not understand the issue you are asking about.
See this example:
http://live.datatables.net/lupugila/1/edit
Kevin
Again - not lengthMenu, pageLength. Leave LengthMenu alone. It doesn't matter.
Change 2 to 4. Save and refresh. Change it to 3, refresh. Notice how it will always show whatever you had first.
Sorry, too early in the morning I guess
If you don't want to save the
pageLength
then use thestateSaveParams
to set the page length to what you want. Like this, see the first table:http://live.datatables.net/lupugila/3/edit
Kevin
Great. Thank you!