Reputation: 1734
Hello i am want make event on press key Enter on keyboard. I am do this:
listeners: {
afterRender: function (thisForm, options) {
this.keyMap = Ext.create(
'Ext.util.KeyMap',
this.el,
[
{
key: 13,
fn: this.submitOnEnter,
scope: this
}
]
);
}
},
submitOnEnter: function (e) {
if (e === 13) {
console.log('some event there!!!')
}
},
but when i press Enter nothing happens.
Upvotes: 1
Views: 2455
Reputation: 318
If it's a textfield or combobox or trigger or something you can try adding a listener for specialkey:
listeners:{
specialkey: function(f,e){
if(e.getKey()==e.ENTER){
console.log("I hit enter!");
}
}
},
If it's just hitting Enter anywhere on the window then I'm not as sure. Something similar might work.
Upvotes: 2