var menuItem1 = new Ext.Panel({
id: 'panelStart',
title: 'Start',
html: 'This is the start page.',
cls:'menuItem',
headerCfg: {
tag: 'div',
cls: 'title-part'
},
listeners: {
afterrender: function (comp) {
var element = comp.getEl();
element.on('click', function() {
alert('ok')
});
}
}
});
Here we can easily access dom node of component but How to get div dom element of headerCfg inside an afterrender function?
ExtJS 4+
Panel header is instance of Ext.panel.Header class so you can simply use down()
method like this:
afterrender: function (panel) {
var header = panel.down('header'),
headerElement = header.getEl();
headerElement.on('click', function () {
alert('ok');
});
}
Here is fiddle.
ExtJS 3
You can use header
property of the panel, like this panel.header.getEl()
.