1. #1
    Sencha User raskri's Avatar
    Join Date
    Dec 2008
    Location
    Stavanger, Norway
    Posts
    73
    Answers
    1
    Vote Rating
    0
    raskri is on a distinguished road

      0  

    Default Answered: My app runs fine before I compile it

    Answered: My app runs fine before I compile it


    I have a problem. To explain my problem:
    Code:
    var panel = new MyApp.view.Test({foo:'bar'});
    and in my Test.initialize function I do this:
    Code:
    Ext.define('MyApp.view.Test', {    extend: 'Ext.Panel',
        initialize: function() {
            this.callParent(arguments);
            console.log(this.foo);
        }
    });
    I get undefined echoed out in the console, only after I compile... Any thoughts?

    I'm using Sencha Cmd v3.0.2.288 on Windows 7 and Sencha Touch 2.1.1

  2. In your panel definition you should really have

    Code:
    Ext.define('MyApp.view.Test', {
        extend : 'Ext.Panel',
    
        config : {
            foo : null
        },
    
        initialize : function () {
            this.callParent(arguments);
            
            console.log(this.getFoo());
        }
    });
    and also use the getFoo method instead of trying to use the foo property as there won't be one. This is the proper way to add configs.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,791
    Answers
    3465
    Vote Rating
    833
    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


    In your panel definition you should really have

    Code:
    Ext.define('MyApp.view.Test', {
        extend : 'Ext.Panel',
    
        config : {
            foo : null
        },
    
        initialize : function () {
            this.callParent(arguments);
            
            console.log(this.getFoo());
        }
    });
    and also use the getFoo method instead of trying to use the foo property as there won't be one. This is the proper way to add configs.
    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 raskri's Avatar
    Join Date
    Dec 2008
    Location
    Stavanger, Norway
    Posts
    73
    Answers
    1
    Vote Rating
    0
    raskri is on a distinguished road

      0  

    Default It woks!

    It woks!


    Thank you so much!

    Little strange that my code works before it is built with Sencha Cmd? Is it not?

    I will start using this way of sending config, I guess I'm laggin from Sencha 1.1.

Thread Participants: 1

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