PDA

View Full Version : Extjs keyup or keydown issue



seamas
1 Apr 2012, 11:00 PM
var tree = Ext.create('Ext.tree.Panel', {
cls: 'my-cool-tree',
useArrows: true,
dockedItems : [ {
xtype : 'toolbar',
items : [ {
xtype : "textfield",
fieldStyle : 'border:1',
enableKeyEvents : true ,
hideLabel : true,
listeners : {
keypress : function(e, t, opts) {
alert(e)
alert( e.getKey() );
}
}
} ]
} ] });


The alert(e) input object ,
but the e.getKey() get error message :e.getKey() is not a function


Please help

friend
2 Apr 2012, 4:19 AM
The keypress method signature is this:



keypress (http://swatdevl/ext-4.0.7/docs/index.html#%21/api/Ext.form.field.Text-event-keypress)( Ext.form.field.Text (http://swatdevl/ext-4.0.7/docs/index.html#%21/api/Ext.form.field.Text) this, Ext.EventObject (http://swatdevl/ext-4.0.7/docs/index.html#%21/api/Ext.EventObject) e, Object (http://swatdevl/ext-4.0.7/docs/index.html#%21/api/Object) eOpts )


I note that you're were naming the first input argument as 'e' and trying to call getKey() on it, where in your case 'e' is a Textfield object.