Search code examples
buttonextjspaginationgrid

Modify params(query) from Grid Paging next button


I'm having some paging issues when I wan't to display the next page with the "next button" from m paging toolbar.

I'm using a form search to display data in my grid, which send along "start" and "limit" params a query (my search more precisely).

listeners: {
    keyup: function(el,type){
        var searchQuery = el.getValue();      //Get the value from the textfield 
        store.load({
            params: {
                start: 0,
                limit: 5,
                query: searchQuery
            }
        });
    }
}

Let's say I was searching for "Apple", the server side script is called like this :

serverSideScript.jsp?query=Apple&start=0&limit=5

So now, the problem is that the next button only send start & limit. Where can I overwrite the load method used by all paging buttons in order to add my personal param.

Thanks in advance for your help. TheRainFall.


Solution

  • One way to do it is to use beforeload listener of the store to fetch any required data and add it to parameters

    beforeload: function(store) {
      store.baseParams.query = getSearchQuery();
    }