1. #1
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    63
    Answers
    1
    Vote Rating
    1
    stevanicus is on a distinguished road

      0  

    Default 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');
                    }            
                    
                }
            }
        }
    });

  2. #2
    Sencha User Izhaki's Avatar
    Join Date
    Apr 2009
    Location
    London
    Posts
    118
    Answers
    7
    Vote Rating
    13
    Izhaki will become famous soon enough

      0  

    Default


    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

  3. #3
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    63
    Answers
    1
    Vote Rating
    1
    stevanicus is on a distinguished road

      0  

    Default


    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
    Code:
    this.application.on({
         myStoreFailed:this.myStoreFailed,
         scope:this
    });
    Inside my listener I have tried to fire the event using

    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

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar