ExtJS 4 – Remembering Paging Params

I’m using the Paging Toolbar for a grid in ExtJS 4.  I have  a search panel and when the user clicks “Search”, the store load is initiated.  I finally got the store to remember it’s parameters and load as I wanted which was:

  • When the search button is clicked, should be loading the first page
  • When the next or previous buttons is clicked on the paging toolbar, go to the previous or next page.
I finally got it work by setting the extraParams field and then instead of calling store.load, called store.loadPage(1) for when the search button is clicked.
Like this:
findUsers: function(searchCrit) {
	this.store.proxy.extraParams = searchCrit;
	this.store.loadPage(1);
}

where searchCrit is an object that has the name/value pairs that I use for the search criteria. This way everytime the user clicks “search” the extraParams is updated with the latest, and the first page is loaded.

Advertisements

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s