2
votes

In the EXTJS 3, I am defining a data store and grid, it is working fine. now the issue is the paging, I want to manually control 'Next' button event.

I tried to use 'beforechange' event in the paging, but it doesn't work, because it is 'BEFORE'. how to manually load the store with parameter value ?

The server side is C#.

Thanks

The store is

  var store = new Ext.data.DirectStore({
            storeId: 'store',
            directFn: Report.Function1,
            autoLoad: false,
            paramsAsHash: false,
            paramOrder: 'param1|start',
            ....
            fields: [ ...   ],
            remoteSort: false,          
        });

The paging is

var pager = new Ext.PagingToolbar({
            store: store,
            displayInfo: true,
            pageSize: this.pageSize,

            listeners: {
                beforechange: function (paging, params) {
                    currentPage = params.start;
                    report_search(params);
                }
            }
        });

 function report_search(page) {
    var store = Ext.StoreMgr.lookup('store');
    store.removeAll();

    store.load({
        params: {
            param1: Ext.getCmp("param1").getValue(),           
            start: page.start
        }
    });
}
1

1 Answers

0
votes

It seems that you want apply a special param to the store before load will be done.
To do this - you need:

this.store.on('beforeload', this.applyParams.createDelegate(this));
...

applyParams: function(store, options) {
    options.params = options.params || {};

    var params = {
        param1: Ext.getCmp("param1").getValue()
    };

    Ext.apply(options.params, params);
}

I hope that you don't need to reject 'Next' button click, cause store can be loaded from other places (automatically, manually from other places).