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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With