1. #1
    Sencha User
    Join Date
    Sep 2012
    Location
    Ljubljana
    Posts
    23
    Vote Rating
    0
    TipyTop is on a distinguished road

      0  

    Default Answered: Adding statics to controller

    Answered: Adding statics to controller


    1. Is it the appropriate to put statics under controller? After all they don't have statics member in config object, but they have method for that, which confuses me immensely.

    2. Does anyone have better solution. I just want to have them declared under this file and not in e.g. app.js.

    Code:
    alternateClassName: 'HM',
    
    constructor: function() {
            this.callParent(arguments);
    
            HM.addStatics({
                pe: '#phonegap=external',
    
                openUrl: function(url) {
                    if (Ext.os.is.Phone) {
                        this.openOutsideWebview(url);
                    }
                    else {
                        window.open(url);
                    }
                },
    
                openOutsideWebview: function(url) {
                    window.open(url + this.pe);
                }
             });
        }

  2. Controllers only have one instance. Why is statics necessarY?

  3. #2
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,167
    Vote Rating
    28
    Answers
    83
    jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough

      0  

    Default


    Controllers only have one instance. Why is statics necessarY?

    Jay Garcia @ModusJesus || Modus Create co-founder
    Ext JS in Action author
    Sencha Touch in Action author

    Get in touch for Ext JS & Sencha Touch Touch Training

    We are also working on Video-based Sencha Touch training: Check it out here.

  4. #3
    Sencha User
    Join Date
    Sep 2012
    Location
    Ljubljana
    Posts
    23
    Vote Rating
    0
    TipyTop is on a distinguished road

      0  

    Default


    Quote Originally Posted by jay@moduscreate.com View Post
    Controllers only have one instance. Why is statics necessarY?
    You are right. It's unnecessary.