0
votes

I have multiple store on my page to load data in extjs grid. I am using a js function to load these store. Based on the search button click event I attach the respective store to the grid. Its working fine. In the load function I have lots of params that I need to send to the backend to fetch the results and show in the grid. Now with pagination in place. Is there anyway that I can add that js function call inside the paging so I can pass those params. Because right now if I click next button in paging nothing is getting returned. since the required parameters are missing to fetch the results. I tried all the given sample on internet but nothing is working.

It would be great if somebody can actually post an example on paging passing parameters or calling js function on next button event.

Any help will be really appreciated. Thank you.

below is the load store function that I want to call on my next event on pagination.

function loadStore(prodId, productsName, doctype, criteria, filename, titlename) {
    store.removeAll();
    store.load({
        params: {
            // specify params for the first page load if using paging
            start: 0,
            limit: g_perPage,
            ajax: "true",
            productId: prodId,
            ProductsNameArr: productsName,
            assetsname: doctype,
            criterianame: criteria,
            newfilename: filename,
            newtitlename: titlename
        }
    });
}
3

3 Answers

0
votes

As Nigel said above the beforeload event is what you are after, see below for an example:

store.on('beforeload',function(store,opts) {
   store.baseParams = { param1: 'foo', param2: 'bar', ... }
});
0
votes

baseParams does not seem particularly useful because it sends static values, not the latest search criteria. Getting the dynamic search criteria is tricky too because the grid (i.e. the form fields) may not exist yet.

The Ext JS devs seem to have consistently mistaken docstring fragments for real documentation making for quite a hellish learning curve with their product. A few real examples here would go a long way.