I recommend you to do it the ExtJS way for handling stores and store instances...
Use the storeId
along with the Ext.StoreManager
. Note that each storeId
need to be unique and as soon as you create a instance of a store it will register itself into the Ext.StoreManager
with its storeId
. You can get a store by calling the lookup('storeId')
on the Ext.StoreManager
. And yes you can do that from anywhere in your code.
For example all Ext.Components
that mixin Ext.util.Binable
(which are most (all) native components that bind a store) will be fine with the storeId
string assigned to the store
cfg property. The Binable mixin will internally lookup it from the StoreManager. If you need to do it yourself
//...
store: Ext.StoreMgr.lookup('storeId') || Ext.create('YourStoreClassname')
//...