PDA

View Full Version : input listeners in Ext.panel.Panel



neosky
15 Jan 2015, 5:06 AM
hello i am want input function for click button in keyboard on Ext.panel.Panel, i do this for: extend: 'Ext.window.Window':


Ext.define('Container',
{extend: 'Ext.window.Window',
alias : 'widget.container',
title : 'book',
listeners: {
afterrender: function (thisForm, options)
{ this.keyMap = Ext.create(
'Ext.util.KeyMap',
this.el,
[
{
key: 13,
fn: function () {
Ext.Msg.alert('title', 'you click enter');
},
scope: this
}
]
);
} },

but when i do this on Ext.panel.Panel it not work (nothing output in the console.):


Ext.define('doc', {
extend: 'Ext.panel.Panel',
alias: 'widget.doc',
listeners: {
afterrender: function (thisForm, options) {
this.keyMap = Ext.create(
'Ext.util.KeyMap',
this.el,
[
{
key: 13,
fn: function () {
Ext.Msg.alert('title', 'enter click');
},
scope: this
}
]
);
} },
how to solve this problem?

lumberjack
20 Jan 2015, 11:12 AM
You'll need to manually make the panel body focusable. This can be done by assigning a tabindex value to the body's dom.

Regards,
Brian

goo