View Full Version : Interesting problem with grid stores reuse

12 Jul 2014, 11:34 AM

I have an interesting problem at hand.

My requirement is that I have a grid, with search bar, to display on five different screens in the application. I extended grid panel to create my component, and I use that (=attributesGrid) as xtype at those respective places.

Issue - Since the store is same for all, if a user filters the grid on one screen, and then navigates to another screen, the second screen too shows filtered data.

What is the best approach in such situations?

Thanks in advance !!


15 Jul 2014, 1:51 PM
When you define the store, you can give it an alias of ‘store.storealias’ (where storealias is your chosen alias name).

For example:

Ext.define('MyApp.store.MyStore', {
extend: 'Ext.data.Store',
storeId: 'MyStore',
alias: 'store.mystore',
fields: ['foo', 'bar']

Now, when you attach your store to your component, you’re actually attaching a new instance of the store and your components can remain separate.

store: {
type: 'mystore'