Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ExtJS paging grid filters only the first page

I am working on a grid which uses filters, but it only filters the first page. When I click 'next' it forgets about my filters and loads the next set of records. How do I make it remember the filter even if I click 'next' to load the next set of records from paging?

Thanks, SS

like image 925
oortcloud_domicile Avatar asked Jul 25 '11 19:07

oortcloud_domicile


1 Answers

You need to set the filter parameters into the store's baseParams. Passing your filter parameters in the load call on the store will only use them for the first load call — subsequent calls made by the paging toolbar won't pass them.

store.setBaseParam('query', 'search-text'); // always send 'query'
store.load({ params: { start: 0, limit: 40 } });
// this will send:
// { query: 'search-text', start: 0, limit: 40 }

store.load({ params: { query: 'bob', start: 41, limit: 40 } });
// baseParams overridden by load params
// { query: 'bob', start: 41, limit: 40 }

store.load();  // only sends baseParams
// { query: 'search-text' } 

The ExtJS Ext.data.Store docs have the details.

like image 196
wes Avatar answered Sep 28 '22 05:09

wes