سؤال

I want to identify which key is pressed on keyUp keyDown or other event on combo box. I have set enableKeyEvents: true, in my config file and added event handler.

this.a.on('keyup', this.onAKeyPress, this);

and function

onAKeyPress: function(e){
        console.log(e.getKey());
    },

And i get error, that e.getKey() is not a function in firebug. But in extJS documentation is said http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.EventObject that e has function getKey(), so where the problem could be?

هل كانت مفيدة؟

المحلول

keyup event has 2 options: the element itself and an event object, which is 2nd argument.

See http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.form.ComboBox-event-keyup

So on your case:

onAKeyPress: function(combo, event) {
    console.log(event.getKey());
},
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top