PDA

View Full Version : Catching bubbled events



quintenvk
24 Apr 2013, 3:48 AM
I have a regular panel, which is created with no items (they're added later through ajax). The items are all items with just html: '<a>(...)</a>' as a property.

I'm adding a listener to the panel from the start like this:



listeners: {
click : function(eventArgs, element, eObj) {
console.log(e);
console.log(element);
console.log(eObj);
}
}


My goal is to catch bubbled events and then stop their propagation. However, the listener isn't listening to the event of the child-items. Does anyone have a clue on how to achieve this?

quintenvk
24 Apr 2013, 4:17 AM
Fixed! I had to attach a click event to the body, not the actual panel. This was after the panel was rendered. I will put up the code for future reference:


var actionPanel = Ext.getCmp('action-
actionPanel.body.on('click',function(eventArgs, element, eObj) {
console.log(eventArgs); console.log(element);
console.log(eObj);
});