PDA

View Full Version : keypress and keydown events in 3.2.1



smitha
28 Feb 2011, 2:16 AM
Hi all,

Does Extjs 3.2.1 support keypress, keydown events? It seems to be not working with that version.


this.queryInput = new Ext.form.TextField({
fieldLabel: this.searchLabelText,
name: 'search',
allowBlank:true,
width: 350,
enableKeyEvents:true,

});

this.queryInput.on('keypress', function(e) {
if (e.getKey()) {
this.updateQuery();
}
}, this);


The keypress event is not getting fired. Can i know where i have gone wrong?

msuresh
28 Feb 2011, 2:20 AM
I am using something like this and it is working fine:



listeners: {
specialkey: function(field, event){
if (event.getKey() == event.ENTER) {
...
event.stopEvent();
}
}
}

smitha
28 Feb 2011, 2:25 AM
Correct, specialkey is working fine for me too. How do u i add listener to keypress and keydown events? Are they even supported in Extjs3.2.1.

Where can i get Extjs 3.2.1 api documentation?

msuresh
28 Feb 2011, 2:33 AM
Just now I tried inside the listener, it is working fine...

I am using the latest version only...



keypress : function(){
alert("Yes working...")
}


Documentation:
http://dev.sencha.com/deploy/dev/docs/source/TextField.html#event-Ext.form.TextField-keydown

smitha
28 Feb 2011, 2:43 AM
Yes, it works fine with latest version. But, my question is whether it works with version 3.2.1?

smitha
28 Feb 2011, 3:09 AM
This is how i am trying to using keydown event. But its not working fine. Can i know what the mistake is?




this.queryInput = new Ext.form.TextField({
fieldLabel: this.searchLabelText,
name: 'search',
allowBlank:true,
width: 350,
enableKeyEvents:true,


});

this.queryInput.on('keydown', function(e) {
if (e.getKey()) {
this.updateQuery();
}
}, this);