PDA

View Full Version : Life cycle of a component.



salhi.mahmoud
13 Apr 2012, 7:49 AM
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()
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
onRender:function(){ this.callParent(arguments);
console.log('smhsopg');
Ext.getCmp('newsMsg').getEl().slideIn('r',{duration:3000,easing:'linear'}).slideOut('l',{duration:3000,easing:'linear'});
} B) in the container but still dont get anything, all i got is this message
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 :) :) :) :)

mitchellsimoens
13 Apr 2012, 8:25 AM
You need to do it int he render or afterrender event so that the element is created.

salhi.mahmoud
13 Apr 2012, 8:50 AM
thank you that helped. :)