Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/375.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Sencha触摸文本字段上的自动对焦_Javascript_Extjs_Sencha Touch_Textfield_Autofocus - Fatal编程技术网

Javascript Sencha触摸文本字段上的自动对焦

Javascript Sencha触摸文本字段上的自动对焦,javascript,extjs,sencha-touch,textfield,autofocus,Javascript,Extjs,Sencha Touch,Textfield,Autofocus,我无法在sencha touch文本字段上进行自动对焦。 我有一个搜索图标,当我点击该图标时,会出现一个文本字段 现在,一旦显示出来,我必须自动聚焦到文本字段并打开键盘。 尝试将侦听器设置为主布局,如下所示 listeners : { show:function(){ Ext.ComponentQuery.query('searchlist #searchAreaOverlay')[0].element.down('input').dom.

我无法在sencha touch文本字段上进行自动对焦。 我有一个搜索图标,当我点击该图标时,会出现一个文本字段 现在,一旦显示出来,我必须自动聚焦到文本字段并打开键盘。 尝试将侦听器设置为主布局,如下所示

listeners : {
            show:function(){

               Ext.ComponentQuery.query('searchlist #searchAreaOverlay')[0].element.down('input').dom.focus();
               setTimeout(function(){Keyboard.hide();Keyboard.show();},500); 
            }

        },
还尝试如下设置textfield的绘制侦听器功能

{
                xtype : 'textfield',
                itemId : 'searchAreaOverlay',
                id : 'searchAreaOverlay',
                layout : 'fit',
                placeHolder:'Search',
                inputCls:'searchfiledInputCls',

                listeners : {
                    painted: function(){


                         Ext.ComponentQuery.query('searchlist #searchAreaOverlay')[0].element.down('input').dom.focus();

                         setTimeout(Keyboard.show(),100); 
                    },
          }
}

没有任何功能。

获取该文本字段的引用,并使用select代替focus

this.getSeachField().select();

试试这个this.input.focus;但为什么不在点击搜索图标的事件时关注文本字段呢?