ExtJS TextField Enter Key After Click External Button

I want to call button click in textfield enter function.

items: [
{
    xtype: 'form',
    id: 'myForm',
    items: [
    {
        xtype: 'textfield',
        id: 'myTextField',
        listeners: {
            specialkey: function(f,e){
                if(e.getKey() == e.ENTER){
                    console.log('Spacial Key = Enter'); // It's working
                    // But i wanna click btnSearch button click event
            }
            }
        }
    }
    ],
    buttons: [
        {
            text: 'Search',
            id: 'btnSearch',
            handlers: function(){
                // bla bla
                // bla bla
                // ...
            }
        }
    ]
}
]

var myform = Ext.getCmp('myForm');
myForm.getForm().submit()

It's working but btnSubmit.click function not working


创建doSearch()方法并从两个处理程序调用此方法将更容易。


根据你的范围,你可以试试这个:

Ext.getCmp("btnSearch").handler.call(Ext.getCmp("btnSearch").scope);

Ext.getCmp('btnSearch').focus();

I Dont Think It But Its Working For Me :)

Thanks For All

链接地址: http://www.djcxy.com/p/58998.html

上一篇: 如何在代码中设置DBX连接池?

下一篇: 单击外部按钮后,ExtJS TextField输入密钥