1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    3
    Vote Rating
    0
    salhi.mahmoud is on a distinguished road

      0  

    Default Answered: Life cycle of a component.

    Answered: Life cycle of a component.


    hi every body, how its going?
    still new in the big world of extjs, i am trying to run an animation of sliding. i create a container and put on it tow components, one of them is to be animated. the problem is that i dont know where to call the methode slideIn()
    Code:
    Ext.getCmp('newsMsg').getEl().slideIn('r',{duration:3000,easing:'linear'}).slideOut('l',{duration:3000,easing:'linear'});
    to run the animation. i tested it in the console of firebug and it works fine. so i thought it may be has something to do with the life cycle of component so i tried to do this
    Code:
     onRender:function(){        this.callParent(arguments);
            console.log('smhsopg');
            Ext.getCmp('newsMsg').getEl().slideIn('r',{duration:3000,easing:'linear'}).slideOut('l',{duration:3000,easing:'linear'});
        }
    in the container but still dont get anything, all i got is this message
    Code:
    Uncaught TypeError: Cannot call method 'slideIn' of undefined
    .
    can anybody give me a clue or/and explain me the life cycle of a component in Extjs 4.
    thank you

  2. You need to do it int he render or afterrender event so that the element is created.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,714
    Vote Rating
    436
    Answers
    3113
    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


    You need to do it int he render or afterrender event so that the element is created.
    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.

  4. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    3
    Vote Rating
    0
    salhi.mahmoud is on a distinguished road

      0  

    Default


    thank you that helped.