1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    22
    Answers
    3
    Vote Rating
    0
    I'm Dennis is on a distinguished road

      0  

    Question Unanswered: Ext.app.Application. Objects creation sequence and using Options Objects

    Unanswered: Ext.app.Application. Objects creation sequence and using Options Objects


    Hey everyone
    I'm trying to build proper Application using Ext.application approach and forcing problem of using objects in configs(options).

    This breif example shows what I'm talking about:
    Code:
    Ext.application({
        name: 'myApp',
        controllers: ['Index']
    });
    Should create a simple app with global var myApp, right?
    Further it creates some myApp.controllers.Index var for desired Index controller.
    Code:
    Ext.define('myApp.controller.Index', {
        extend: 'Ext.app.Controller',
        stores: ['MyCustomStore'];
    
        // I create this method here to be used in several Stores and not copy-pasted there
        myCustomFunctionToHandleRestExceptions: function(response) {
         
       }
        ...
    });
    This code helps me create MyCostomStore to be used in application, right?
    Next I try to create this store
    Code:
    Ext.define('myApp.store.MyCustomStore', {
        extend: 'Ext.data.Store',
        autoLoad: true,
        proxy: {
            type: 'rest',
            url: '/myURLHere',
            reader: {
                type: 'json'
            },
            listeners: {
                exception(): function(proxy, response, operation) {
                     if (response.status == 401) {
                          // following line tries to handle 401 response using Index controller. And fails
                          myApp.getCotroller('Index').myCustomFunctionToHandleRestExceptions(response);
                     }
                }
            }
    });
    That red line fails due to myApp variable is not created at that moment and I'm trying to use it in Options object for listeners ...

    1. Which is proper/common approach for situations like that? Should I use something like initComponent method in this case instead of my attempts to pass objects via config files?

    2. Where to read the sequence of creation of all those objects (application, controller, store etc) in context of Ext.app.Application.

    Thanks

  2. #2
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,669
    Answers
    130
    Vote Rating
    110
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    you can controll the events of stores in your controllers as well.
    there you have the application reference and it should be cleaner imho.
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

Thread Participants: 1

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