我得到了Uncaught :无法调用未定义的的“焦点”方法
发生在
Ext.Msg.prompt with #myinput closed and then opened **again**.
Ext.getCmp('myinput').focus(); works fine for the first time only. How to set the cursor into `myinput` always?
这是第一次只打开消息框。
更新:下面是我的核心代码。
Ext.Msg.prompt('',
'Some text description',
function(btn, text) {
},
this,
false,
null,
{ placeHolder: 'Please enter some text here', xtype: 'numberfield', id: 'myinput' }
);
Ext.getCmp('myinput').focus();
发布于 2013-06-24 09:19:45
这意味着Ext.getCmp('myinput')
找不到您的字段。因此,可能在调用函数时尚未创建字段,或者在id中有一个类型,或者,根据您的描述,您第二次调用该字段时,字段已被销毁.没有周围的代码是不可能确定的。
发布于 2013-06-24 14:41:30
尝试组件查询。
Ext.ComponentQuery.query("#myinput").focus();
https://stackoverflow.com/questions/17271888
复制相似问题