PDA

View Full Version : One Store, Multiple Grids Filtered



kimosabi
23 Feb 2012, 10:35 PM
I've just written my first app on ext 4 coming from a mostly ext 3 background.

I've got a situation where I have 4 grids accessing the same store, now I want have a filtered set of data in each one. Problem is, when I filter per grid, the store data disappears from all the other 3 filtered grids. I'd like to keep everything in one store so that updates via forms are updainting and syncing from the same store.

At the moment, I'm using the following code to filter on a config property I'm passing into the widget.



,onRender:function(){
this.store.filter('status',this.status);
}


Just a heads up in the right direction would help me greatly. Thank you.

chramer
24 Feb 2012, 12:48 AM
you can create 4 instances of the same store.. :)

kimosabi
24 Feb 2012, 6:22 AM
Thanks for the tip, I ended up adding this to the grid widget. Not sure if its best practice, but its working.



,onRender:function(){
this.store.clearFilter();
this.store.filter('status',this.status);
this.callParent(arguments);
}
,onShow:function(){
this.store.clearFilter();
this.store.filter('status',this.status);
this.callParent(arguments);
}