The thing with the array of controller stores is that it will override any storeId . After loading the storage class, the controller sets storeId by namespace convention, creates the storage, and creates the getter method using the value as soreId .
Let me enter option 4
- Define one store for the view and require it in the view (you can also require it in the controller, just use the
requires array). - Select valid itemId for views and a valid storeId for your store, which should depend on the
itemId view (set it when creating the view!). - In
initComponent create a storeId and find the store in the StoreManager. If it does not exist, create it and supply the client configuration and storeId .
If you need to destroy the show and the store every time, check out this post.
InitComponent demo
initComponent: function() { var me = this, storeId = me.storeId + me.itemId; me.store = Ext.StoreManager.lookup(storeId); if(me.store === null) me.store = Ext.create('App.data.CustomViewStore',Ext.apply({storeId: storeId},me.storeCfg || {})); me.callParent(arguments); }
Note. If you load a view using the views array, you will get a receiver that might not give you the expected view. Here you can also use the required controller array. If you want to use getter, just create your own using refs config.
source share