View Full Version : Application of Grid and Store filtering

21 Nov 2010, 8:03 PM
My website processes a continuously updating stream of JSON - In an effort to keep traffic at a minimum I'd like to maintain a store of updates that is used for more than one grid. Currently, as updates come in, the affected rows are updated in an Ext.data.Store with a JSON reader. The store is bound to an Ext.grid.GridPanel and Ext.DataView panel.

The problem comes in when I try to create a second GridPanel from the same store (but filtered). Any filtering applied to one grid results in modifying the other. I've researched 2 types of filtering:
1.) Use plugin for GridFilters

As an example, I modified the grid-filtering example grid-filter-local.js and added my own button to apply a custom filter:

handler: function () {
grid.filters.clearFilters(); //for some reason, this is required first to set the filter programatically
grid.filters.addFilter({ "dataIndex": "company", "type": "string", "value": "w"});

Creating a second grid panel and column model, but bound to the same store will end up applying filters and sorting to both grids

2.) Apply filter on store

myStore.filter('company', 'w', true, true);Again, any grids using this store get filtered.

Do I have to create a copy of the store to apply different filtering? Should I be looking at some other Ext data structure?

Any help is much appreciated,

22 Nov 2010, 1:39 AM
Correct, a store filter applies to all linked components, so if you want to display some components with all data and some with filtered data, you will need two stores.