0

I am unable to make autofocus on the sencha touch textfield. I have search icon, when I tap on that icon a textfield will appear Now as soon as it is shown I have to autofocus to that textfield and open the keyboard. Tried setting listeners to main layout as below

listeners : {
            show:function(){

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

        },

Also tried setting painted listener function of textfield as below

{
                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); 
                    },
          }
}

Nothing is working.

Cœur
  • 37,241
  • 25
  • 195
  • 267
hari86
  • 659
  • 2
  • 16
  • 28

1 Answers1

0

Get reference of that text field and instead of focus use select.

this.getSeachField().select();
Mohit Saxena
  • 1,439
  • 1
  • 12
  • 21