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

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(){
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

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

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.

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.