-
paging grid params
One of my grids is loaded by sending several filter options that modify a db query, without these params the query cannot be constructed. In adding paging I have found that while I load the grid with the needed params the first time it does not send the orginal params for each page click. Is there a better way to do this than attaching a listener to a beforeload event and moding baseparams each time?
My initial store load:
Code:
store.load({params: {filter: filter, data: data, start:0, limit:25}});
-
[Edit] Oops, I see the end of your post mentions baseParams, why do you need to modify each time ?
Look at baseParams and setBaseParam in Store API.
Also, the Grid FAQ can help with these and many other questions.
-
I know I could use setbaseparams on a click of the paging toolbar, im wondering if there is a better builtin way to use the params that were sent in the store in the last request.
-
My server is expecting filter and data each time along with start and limit, filter and data are not static they change based on the view. So I load my grid during the initial load with filter, data, start and limit, now someone clicks a page button and filter and data are not included in the next request sent. It seems like there should be some built in method of using the same params that were sent the time before without having to create a listener and set and modify base params on every click.
-
You could also do this:
Code:
Ext.override(Ext.PagingToolbar, {
doLoad : function(start){
var o = {}, pn = this.getParams();
o[pn.start] = start;
o[pn.limit] = this.pageSize;
if(this.fireEvent('beforechange', this, o) !== false){
var options = Ext.apply({}, this.store.lastOptions);
options.params = Ext.applyIf(o, options.params);
this.store.load(options);
}
}
});
to make the paging toolbar reuse all load options except start and limit parameters.
-
Perfect Condor, would be great to see that built in =0
-
Made a feature request for it.
-
Are you using remote sorting? Wouldn't that have an issue with params too?
-
Thanx a lot Condor this works perfectly. Really hope they include it ;)
Been struggling for hours trying to get the paging working with my filtering =P~
-
Thanks that works perfectly.