View Full Version : "default" button (ie - click when user presses enter)

7 Nov 2012, 8:33 AM
I have a login window - and want the "OK" button to fire when the user clicks on it - or presses the Return/Enter keys..

I have another panel where I have a single line textfield and a button - and again -when the user presses the enter key - I want the button to act as if it were clicked..

Is this possible ?

Tim Toady
7 Nov 2012, 9:06 AM
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.util.KeyMap (http://docs.sencha.com/ext-js/4-1/#%21/api/Ext.util.KeyMap)

There is also a private method called getKeyMap you could use and just add a binding. Window uses it for onEsc. I try to avoid using private methods though.