问题
How to get the char codes of the arrow keys in extjs?
I tried the below code which is working good to get the char codes of all the keyboard buttons but not the arrow keys(also Backspace).
Ext.getDoc().on('keypress', function(event, target) {
console.log(event.getCharCode())
});
Before asking here, I have gone through the documentation which I can't understand.
and also If I press backspace
then the page is redirecting to previous page. I am planning to keep my own function in future on backspace
. How to override it in extjs?
I am a beginner. So, please provide simple example..
回答1:
To archive this you need to use monitoring like
instance.mon(Ext.getDoc(), Ext.EventManager.getKeyEvent(), instance.callBack, instance)
see JSFiddle (I think you can check for the right key)
回答2:
There is an example of exactly that in the documentation: http://dev.sencha.com/deploy/ext-4.1.0-gpl/examples/keynav/keynav.html
来源:https://stackoverflow.com/questions/14706218/create-event-for-arrow-keys-in-extjs