PDA

View Full Version : Who is listening to a specific component



EPV
24 Jun 2013, 10:21 AM
Strange question maybe, but ...

Let's say you have a panel with an afterrender listener like:



listeners:{
afterrender:
{
fn: function(){ console.log('afterrender'); }
}
}


Is it possible to somehow check if a specific panel has an afterrender listener? Or, list all component that has an afterrender listener attached to it?

I'm aware of ...




mypanel.hasListeners // Property

Ext.app.EventBus // Description of the evenbus


... but those only seem to work if the listeners are attached in the controller.



this.control({
'panel': {
afterrender: this.onPanelRendered
}
});


Thanks / E

slemmon
25 Jun 2013, 10:26 PM
Are you saying hasListeners only works if the listeners are attached in the controller?



var panel = Ext.create('Ext.panel.Panel', {
title: 'Hello',
width: 200,
html: '<p>World!</p>',
renderTo: Ext.getBody(),
listeners: {
afterrender: function () {
//
}
}
});
console.log(panel.hasListeners.afterrender);

EPV
17 Jul 2013, 11:01 AM
Thanks Slemmon!
Must have messed up my tests, "hasListeners" works as expected:)