我正在使用Ext.getCmp在选项卡面板中查找一个extjs组件.有时它不能正常返回undefined.
var currComp = Ext.getCmp('myId'); //Id is generated by me on creation
Run Code Online (Sandbox Code Playgroud)
还有其他方法吗?如果我知道它的ID,找到一个组件?
如果您知道父控件,则可以使用getComponent方法.
getComponent - 检查此容器的items属性并获取此容器的直接子组件.
var compont = parentControl.getComponent('yourId');
Run Code Online (Sandbox Code Playgroud)
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.container.AbstractContainer-method-getComponent
创建时尝试设置itemId.