PDA

View Full Version : Can't Add Clik Handler To Panel ??



chalu
29 May 2008, 10:26 AM
Ext.ux.MyPanel = Ext.extend(Ext.panel, {
...
initComponent: function(){
...
Ext.ux.MyPanel.superclass.initComponent.apply(this, arguments);
this.on('click', this.onClick, this);
},

onClick: function(){
console.log('In');
console.log(this);
}
});
Ext.reg('mypanel', Ext.ux.MyPanel);

This block of code tries to create a custom panel with a click handler, has has not worked yet, any suggestions. I (originally) wanted to add a contextmenu to the panel, but without success. Does Ext.Panel (from the Docs) have aany 'click' event, though the 'addListener' function examples show some

chalu
29 May 2008, 11:46 AM
Any body there ???

NoahK17
29 May 2008, 11:52 AM
Panels do not fire an activate event unless they are children of a TabPanel which activates them. So that is why your "onClick" listener does not work.

devnull
29 May 2008, 11:52 AM
I do know that you cannot add normal dom events to components because... they arent dom nodes :)
you need to add the listener to the underlying element.