0
votes

I am developing application with Ext js 4 and just found a small but annoying problem:

I have a grid with toolbar at the top that searches users. At the bottom I used pagination. Everything works fine if I search for a user and view other pages with next prev buttons.

However the problem starts when I start new search. Let say I have searched for a user with login 'smith' and my store loaded 100 records, 4 pages with 25 users in each. If I go to 3rd page and search for another user with 'john' my store loads 0 records but I have two records to be found in my database. The problem is pagination is sending limit, start parameters from last search in which I was in 3rd page. If I were in the 1st page and made new search it would show that 2 new records.

Am I doing anything wrong? What should I do to start new searches with fresh pagination parameters. I have lots of stores, so setting limit and start parameters in click function of my search button is too much work for me, is there any smarter way?

1
Can you post the code of how you're making the subsequent request? I do the same thing all the time, but the paging data is refreshed on new searches.existdissolve

1 Answers

0
votes

Instead of using store loads you can just use moveFirst method of pagingtoolbar.

onSearch:function(){
  //this will load the store with new limit and page params.
  pagingtoolbar.moveFirst(); 
} 

In Store.js,you can send extraparams in beforeload listener.

listeners:{
   beforeload:function(){
       uname = Ext.getCmp('uname').getValue();
       //send the extraparams
       this.proxy.extraParams.user= uname;
   }
}