Rency
Rency

Reputation: 404

Ext.getCmp not working in extjs

I am using Ext.getCmp for finding one extjs component in tab panel. some times it is not working an returning undefined.

var currComp = Ext.getCmp('myId'); //Id is generated by me on creation

Is any other method exists? to find one Component if i know its id?

Upvotes: 3

Views: 13371

Answers (1)

Jom
Jom

Reputation: 1897

If you know the parent control then getComponent method can be used.

getComponent - Examines this container's items property and gets a direct child component of this container.

 var compont = parentControl.getComponent('yourId');

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.container.AbstractContainer-method-getComponent

Try to set the itemId also when creating.

Upvotes: 5

Related Questions