1. #1
    Sencha User
    Join Date
    Nov 2010
    Posts
    351
    Vote Rating
    4
    gkatz is on a distinguished road

      0  

    Default class question

    class question


    Hi;
    watching the sencha video of the new class system I am still confused about some things:
    1. the lifecycle of the objects: the video shows the use of the constructor method. looking at the sencha 2 code there's some code that uses initialize method (not sure what it does).
    2. video shows using .initConfig(config); inside the constructor for the benefit of get/set/apply/etc. this worked for me for a component that does not inherit anything, once I used 'extend: ext.container' I got an exception (see below)
    3. looking at some sencha code and extensions I mostly saw people using callparent([config]). is this the same?
    4. I am somewhat confused and would appreciate your help
    thanks

    Code:

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,582
    Vote Rating
    434
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    constructor is the initial method that gets called when creating a component. initialize happens a little later so it just depends on what you need to do and where you can do it.

    initConfig(config) will create the getters/setters and such but a component should have that called automatically so you may not have to. I would check to see if it is already there before I would call initConfig.

    callParent will call the class that you are extending method so you don't loose functionality.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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