Threaded View

  1. #1
    Sencha User Arg0n's Avatar
    Join Date
    Apr 2012
    Location
    Germany
    Posts
    122
    Answers
    12
    Vote Rating
    16
    Arg0n will become famous soon enough Arg0n will become famous soon enough

      0  

    Default Answered: Store global load event in MVC

    Answered: Store global load event in MVC


    I want to listen on load of all stores. Is there a way I can do it in a MVC structure? :x

    I already thought about extending from the 'Ext.data.Store' class, but it wont work, because the class extinding it needs to be a store itself. So I read about the observable class, but this seems to be the wrong way too...
    I don't want to register a load listener for each store I have... I would lik eto have global load listener.

  2. I tested just now with the following and it worked for me (using ExtJS 4.1.1a - I think you need 4.1.1 or higher for Ext.application's init method to fire - was a bug fix)

    inside my Ext.application - moved setting up the global variable.app (MYAPP.app) to the init function of Ext.application instead.
    Code:
    init: function () {
        var me = this;
        MYAPP.app = me;
        Ext.data.StoreManager.on('add', function (i, store) {
            store.on('load', function () {        // or datachanged or whatever you want
                LARGE.app.fireEvent('storeload', store);
            });
        });
    }
    Now from any controller you can add a listener for 'storeload'. The below snippet I put in one of my controller's init function
    Code:
    me.application.on('storeload', function (store) { console.log(store); });
    That's how I saw ... I think Tommy Maintz ... can't remember ... fire and handle application level events and it's worked well for me.

Thread Participants: 2

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi