Extjs4 按alert ok按钮时,在extjs中设置窗体字段的焦点

Extjs4 按alert ok按钮时,在extjs中设置窗体字段的焦点,extjs4,Extjs4,当我按下alert ok按钮时,我想在extjs中的数字字段中设置焦点,但我不能这样做,我尝试了这个系统。这是我的密码 Ext.Msg.alert("Invoice",'Invoice Id &nbsp'+invno + '&nbsp is not Available'); Ext.getCmp('InvoiceNo').focus(true); 我的数字字段是 { xtype : '

当我按下alert ok按钮时,我想在extjs中的数字字段中设置焦点,但我不能这样做,我尝试了这个系统。这是我的密码

Ext.Msg.alert("Invoice",'Invoice Id &nbsp'+invno + '&nbsp  is not Available');  
                        Ext.getCmp('InvoiceNo').focus(true);
我的数字字段是

{
        xtype             : 'numberfield',                
        hideTrigger       : true,
        decimalPrecision  : 0,
        keyNavEnabled     : false,
        mouseWheelEnabled : false,
        fieldLabel        : 'InvoiceNo',
        id                : 'InvoiceNo',
        name              : 'InvoiceNo',
        enableKeyEvents   : true,                           
        //minValue          : 1,
        msgDisplay        : 'tooltip',
        anchor            : '95%',
        }

我可以通过这个过程来做

 var v = Ext.getCmp('InvoiceNo').getValue();
Ext.Msg.confirm('InvoiceNo','InvoiceNo'+v , function (button) {
  var InvoiceNo = Ext.getCmp('InvoiceNo');
    if (button == 'yes') {
        setTimeout(function(){
            InvoiceNo.setValue(v);
            InvoiceNo.focus(true)[0];
        },100);                             
    }                                
}, this);