I'm trying to make the tabs in tabpanel navigable using arrow keys.
As tabpanel has no key events, my guess was to create a KeyMap or a KeyNav and attach it to the panel this way: This is part of the tabpanel def, it's inside another panel:
activeTab : 0,
xtype : 'tabpanel',
id : 'tabPanel',
alias : 'widget.mainpanels',
listeners: {
afterrender: function(tb) {
this.bindDetailsPanelKeys(tb);
},
scope: this
}, [...]
And the function bindDetailsPanelKeys:
bindDetailsPanelKeys: function(tb) {
console.log(tb); //Checking tb is the correct object.
var tbMap = new Ext.util.KeyMap(tb, {
key: Ext.EventObject.RIGHT,
fn: function(e) {
console.log(e);
// Code to calculate next tab and switch it.
}
});
console.log(tb) output is as expected, it contains the tab panel object.
But all I receive after that is: Uncaught TypeError: Cannot call method 'on' of null
from line var tbMap = new Ext.util.KeyMap(tb, {
I've checked the El property of tb and it's also correct and it has the on method on it's proto as well.
Any help will be very appreciated.
EDIT: I've found the solution. I'll post it in a moment.
Agustin.