0

So I have and Ext js application and in my application launch function at the bottom, after I draw components there is the next line of code:

Ext.ComponentManager.all.on('render', function(cmp) { console.log(cmp); });

I expect that all components go through this function before being rendered to user but it's not. can you give any suggestions what can be happening? Anyway, what I want to do is to catch render or beforerender event of all components in a single place. yeah my application uses MVC architecture

guido
  • 18,864
  • 6
  • 70
  • 95
Dimitri
  • 2,798
  • 7
  • 39
  • 59

1 Answers1

1

In your controller you can add listeners for these events to all components using * as the component query:

this.control({
    '*': {
        beforerender: function(cmp) {
            console.log('beforerender: ' + cmp.id);
        },
        render: function(cmp) {
            console.log('render: ' + cmp.id);
        }
    }
});
matt
  • 4,027
  • 2
  • 25
  • 32
  • I would have to do that in all controllers yes? Is not there any other place? Thanks anyway for suggestion. – Dimitri Apr 04 '14 at 14:11
  • It should be enough to do that in one controller, as the [ComponentQuery](http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.ComponentQuery) is applied globally. – matt Apr 04 '14 at 14:15