PDA

View Full Version : How to reset paging config



javafreshman
29 Dec 2011, 7:27 AM
Found that the paging example (http://sencha.com/examples/#paging) will remember the page I selected last time. Such as when I switch to page 3 and then delete cookie, cache from IE and close the browser. When I open the browser again, the grid still can automatically swtich to page 3 when the example load to the browser.

How can I reset the page and sorting field config everytime I reload the page?

Colin Alworth
29 Dec 2011, 8:41 PM
In that example, the relevant code is here:



final Grid<Post> grid = new Grid<Post>(store, cm);
grid.setStateId("pagingGridExample");
grid.setStateful(true);


Look in your cookies for that domain for a cookie called pagingGridExample - the data is stored in that. Close the page, clear the cookie, and re-open it to reset.

If you are trying to implement this yourself, start with those setters in the example - if you need to reset it, one option would be to invoke setters on the toolbar, as that is what is used to drive the state that is persisted in cookies.