首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >森查触觉2:

森查触觉2:
EN

Stack Overflow用户
提问于 2013-06-24 09:14:21
回答 2查看 261关注 0票数 1

我得到了Uncaught :无法调用未定义的的“焦点”方法

发生在

代码语言:javascript
运行
复制
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?

这是第一次只打开消息框。

更新:下面是我的核心代码。

代码语言:javascript
运行
复制
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();
EN

回答 2

Stack Overflow用户

发布于 2013-06-24 09:19:45

这意味着Ext.getCmp('myinput')找不到您的字段。因此,可能在调用函数时尚未创建字段,或者在id中有一个类型,或者,根据您的描述,您第二次调用该字段时,字段已被销毁.没有周围的代码是不可能确定的。

票数 0
EN

Stack Overflow用户

发布于 2013-06-24 14:41:30

尝试组件查询。

Ext.ComponentQuery.query("#myinput").focus();

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17271888

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档