PDA

View Full Version : ExtJS specialkey() - How to cancel keypress?



neurodon
3 May 2012, 11:55 AM
I am capturing the right and left keys inside of a ComboBox for page navigation on a remote store. The pages move successfully, however I need to cancel the original event as to not cause cursor movement in the original ComboBox. Here is my event handler:



specialkey: function(field,e) {
switch(e.getKey()) {
case e.ESC:
field.reset();
break;
case e.RIGHT:
field.getPicker().pagingToolbar.moveNext();
break;
case e.LEFT:
field.getPicker().pagingToolbar.movePrevious();
break;
}
return false;
}


I looked at the Ext class code and it seems to call via a chained event:



fireKey: function(e){
if(e.isSpecialKey()){
this.fireEvent('specialkey', this, Ext.create('Ext.EventObjectImpl', e));
}
},


What's the standard way of doing this?

Brandon

scottmartin
3 May 2012, 12:22 PM
Perhaps e.stopEvent()?

Regards,
Scott.

neurodon
3 May 2012, 12:24 PM
That worked. Thank you Scott!