How to set selected page is last page?

How to set selected page is last page?

sodevensodeven Posts: 1Questions: 1Answers: 0

i am using stateSave: true,
for example i have a 4 pages table.
when i remove all rows in the 4th page, it goes 1st page. But in normally it must go 3rd page.
How to fix it?

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    Yep, because the shape of the table has changed, and page 4 is no longer viable, the table will default to showing the first page.

    You could do one of two things. Either check the values in stateLoadParams, and if the page in the saved data isn't valid, tweak it to a sensible value. Or, you could do something similar in initComplete - calling state.loaded() to get the loaded info, see if the page is the same, and if not, call page() to reset the page.

    Colin

This discussion has been closed.