1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    31
    Vote Rating
    0
    fenderico is on a distinguished road

      0  

    Default Answered: How to define global config for a sencha app

    Answered: How to define global config for a sencha app


    Hello everybody,

    I'd like to know which's the way to define global configuration to be used from the Controllers and Views. Is there any 'sencha-way' to do so? or should I use just simple javascript global variables which is not, I know, the best way?

    Thanks in advance,

  2. What I do is have a singleton class..

    Code:
    Ext.define('MyApp.util.Config', {
        singleton : true,
    
        config : {
            foo : 'bar'
        }
    });
    Then you can do

    Code:
    MyApp.util.Config.getFoo();

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,801
    Answers
    3467
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    What I do is have a singleton class..

    Code:
    Ext.define('MyApp.util.Config', {
        singleton : true,
    
        config : {
            foo : 'bar'
        }
    });
    Then you can do

    Code:
    MyApp.util.Config.getFoo();
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    31
    Vote Rating
    0
    fenderico is on a distinguished road

      0  

    Default


    thank you for your quick response!

  5. #4
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    88
    Answers
    3
    Vote Rating
    5
    whirling dervish is on a distinguished road

      0  

    Default


    Sorry to bring this thread back from the dead but I have a follow up question.

    Is using a singleton object to store variables preferable to using a namespace for the same purpose?

  6. #5
    Sencha User
    Join Date
    Apr 2012
    Posts
    18
    Vote Rating
    0
    acorotchi is on a distinguished road

      0  

    Default Sencha 2.1 andCmd 3.0 config issue

    Sencha 2.1 andCmd 3.0 config issue


    Hi guys, I used this class as well for my app config, but when I upgrade my sencha I have issue when I try to build production and I have not idea what is the issue :

    Code:
    TypeError: Object #<Object> has no method 'define'

    Is someone having the same issue, or do you know a fix bu change.

    Thanks in advice .

  7. #6
    Sencha User
    Join Date
    Mar 2012
    Location
    China
    Posts
    13
    Vote Rating
    -1
    youngshine is an unknown quantity at this point

      0  

    Default



  8. #7
    Sencha User
    Join Date
    Aug 2010
    Posts
    23
    Answers
    1
    Vote Rating
    2
    TheRegge is on a distinguished road

      0  

    Default Overide the constructor?

    Overide the constructor?


    I still work on v2.1 for my project, but the config class does not work for me if I don't overwrite the constructor with:

    Code:
        constructor: function (config) {
            this.initConfig(config);
            return this;
        }
    Without this, it seems that the getters are not created...

    I got this from http://senchatouchdev.com/wordpress/...cha-touch-2-x/

    Cheers.

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