-
8 Jul 2012 3:23 AM #1
Unanswered: [EXTJS4.1][MVC] How to reuse a component?
Unanswered: [EXTJS4.1][MVC] How to reuse a component?
Hi,
How to reuse a component MVC? Each component should have its own instance of store. Now I create two instances of component (controller, view, store). How to filter data in first component? Only first, without affecting data in second component.
Regards,
Marcin
-
9 Aug 2012 11:29 PM #2
I am facing the same problem how can i reuse to same store for different components
-
20 Aug 2012 5:38 PM #3
To reuse the same store with multiple components just refer to it by name like this:
Assuming you have store Sample defined
You can refer to it in view(s):Code:Ext.define('XX.store.Sample', {...});
Keep in mind though that both combobox and grid share the same instance of store, so all filtering/sorting/changes to it will be automatically propagated to both.Code:Ext.define('XX.view.PanelX', { .... initComponent: function(){ this.items = [ { xtype: 'combo', itemId: 'comboOne', ..... store: 'Sample' }, { xtype: 'grid', itemId: 'comboTwo', .... store: 'Sample' } ] } }
-
20 Aug 2012 5:51 PM #4
-
20 Aug 2012 7:39 PM #5
Thank you for your reply.I tried to create to instances of the store ,this helps in applying different filtering/sorting/changes to each store


Reply With Quote