2
votes

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..

2

2 Answers

2
votes

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)