PDA

View Full Version : Store listeners



castitas
14 May 2012, 9:36 AM
I have a store with a listener. I want the scope to be the controller, so that I can use one of the controller's functions (onError).


Ext.define('app.store.myresource.Store', {
extend: 'app.store',
proxy : { ...},
listeners: {
write: {
fn: this.writeErrorHandler,
// scope: ? // the controller
}
}
});

I didn't want to put the function on the store, to hold to best practice.
I'm open to suggestions.

Tim Toady
14 May 2012, 10:57 AM
I usually just get a reference to the store in the controller's init method and add the listener there.