-
Sencha User
Answered: How to reference store and define control callback in controller?
Hi ALL,
I would like to reference a store and define handlers for it's events. Here is the case:
Ext.define('MobileApp.controller.ContactTag', {
extend: 'Ext.app.Controller',
......
config: {
refs: {
storeContactTags: {
selector: '#storeContactTag'
}
},
control: {
storeContactTags: {
load: 'storeContactTagLoaded'
}
}
}
....
}
==============
Ext.define('MobileApp.store.ContactTag', {
extend: 'Ext.data.Stroe',
config: {
id: 'storeContactTag'
....
}
}
The store is used for a Ext.List obj. When ContactTags performs CRUD, all relevant views (like form.Panel) should update at the same time.
I suppose to do the definition in controller. But it doesn't work as I though. Therefore I have to specify a listener in the store (that I think it is not appropriate):
Ext.define('MobileApp.store.ContactTag', {
extend: 'Ext.data.Stroe',
listeners: {
load: function(store, records, successful, operation, eOpts) {
......
}
}
}
Anyone has better solutions??
-
Best Answer Posted by
liaoyiwu
Store is not a component, so you can not use the refs or control to locate the Store,
give the Store a storeId, then use Ext.getStore('storeId').load(...)
-
Sencha User
Store is not a component, so you can not use the refs or control to locate the Store,
give the Store a storeId, then use Ext.getStore('storeId').load(...)
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules