Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear the store and update a paging toolbar?

Tags:

extjs

extjs4

i need to reset paging toolbar parameters as "page", "start", "limit" when i click on a search button to re-load grid store with different parametres!

how can i do it?

the problem is that when i am on the next page, and i do a new search, i have the parameters page=2, start=25, limit=25 dirty, instead i need to reset this parametres.

my code:

listeners: {
    click: function(){
        Ext.getCmp('GrlGio').getStore().removeAll();
        Ext.getCmp('GrlGio').store.load({
                params:{
                  mode: "RIC",
                  DataRicerca: dd,
                  Pit: Ext.getCmp('cmbPiattaforma').getValue()
                }
        });
    }
 }

thanks!

like image 275
jack.cap.rooney Avatar asked Sep 15 '11 15:09

jack.cap.rooney


4 Answers

In Ext 4, I found loadPage() worked pretty well for resetting the data store and making the paging toolbar go back to the first page. Example:

store.loadPage(1) // note: 1-based, not 0-based
like image 100
XåpplI'-I0llwlg'I - Avatar answered Dec 21 '22 07:12

XåpplI'-I0llwlg'I -


Guys currentPage=1 did the trick for me

before loading the store every time call the below By the way i am getting 500 results and loading in cache Pagination is for local, any way you can try this before any new search

                        var store = Ext.getStore('MyStoreS');
                        store.proxy.extraParams = { employeeId : searchStr};

                        store.currentPage = 1;

                        store.load();
like image 45
StackOverFlow Newbie Avatar answered Dec 21 '22 08:12

StackOverFlow Newbie


you can manualy reset the params

Ext.getCmp('GrlGio').getStore().getProxy().pageParam =1;
Ext.getCmp('GrlGio').getStore().getProxy().startParam =0;

and then do the store load. I know it looks hardcoded but it's the only solution i found...

like image 33
nscrob Avatar answered Dec 21 '22 06:12

nscrob


Try this -

pagingToolbar.moveFirst();
like image 29
Amol Katdare Avatar answered Dec 21 '22 08:12

Amol Katdare