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
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Answers
    102
    Vote Rating
    77
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    Controllers only have one instance. Why is statics necessarY?

  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.

Thread Participants: 1