Article
How can I subscribe to an event of pressing a button (e.g., ENTER)?
18:10 Feb 05, 2018
Question
How can I subscribe to an event of pressing a keyboard key to be able to perform certain actions upon pressing?
Answer
You can subscribe to any Ext component via Ext.util.KeyMap
For example:
onEntityInitialized: function() {
this.callParent(arguments);
var map = new Ext.util.KeyMap({
target: "AccountPageV2CodeTextEdit-el",
key: Ext.EventObject.ENTER,
fn: this.myHandler,
scope: this
});
},
myHandler: function() {
alert("ENTER");
},