-
25 Jun 2012 5:48 AM #1
Unanswered: Store fireEvent
Unanswered: Store fireEvent
Hi,
Does anyone know how to fire a custom event in a store and listen for it in a controller using ExtJS 4 MCV pattern.
Thanks in advance
For example
Code:Ext.define('App.store.MyStore', { extend:'Ext.data.Store', listeners:{ load:{ fn:function(store, records, success, obj){ if(!success){ store.fireEvent('MyStoreFailure'); } } } } });
-
25 Jun 2012 6:29 AM #2
Your code should be working (store does have fireEvent method).
In your controller's init you should have something like this:
Code:this.getUsersStore().on({ MyStoreFailure: this.onStoreFailure, scope: this });Last edited by Izhaki; 25 Jun 2012 at 6:30 AM. Reason: Typo
-
25 Jun 2012 11:28 PM #3
Unfortunately it doesn't.... I forgot to mention that my store is a 'base' (i.e. superclass) store for all stores. It fires an event when any (extending) store fails. However that custom event just doesnt seem to be catchable.
I would like to catch it in my controller using
Inside my listener I have tried to fire the event usingCode:this.application.on({ myStoreFailed:this.myStoreFailed, scope:this });
Code:store.fireEvent('myStoreFailure'); //the store that extends this store - i.e the one that has failed store.superclass.fireEvent('myStoreFailure'); //this store that fires the event and has the listener for load


Reply With Quote