Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ExtJS TextField Enter Key After Click External Button

Tags:

extjs

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

like image 922
Ekrem OĞUL Avatar asked Apr 19 '12 10:04

Ekrem OĞUL


1 Answers

this code working :

    {
                            fieldLabel : 'Password',
                            name : 'j_password',
                            inputType : 'password',
                            allowBlank : false,
                            listeners : {
                                'render' : function(cmp) {
                                    cmp.getEl().on('keypress', function(e) {
                                        if (e.getKey() == e.ENTER) {
                                            submitform();
                                        }
                                    });
                                }
                            }
   }
like image 137
jayesh Avatar answered Sep 30 '22 11:09

jayesh