Dimitri
Dimitri

Reputation: 2858

Ext JS handling events in a single place

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

Upvotes: 1

Views: 80

Answers (1)

matt
matt

Reputation: 4047

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);
        }
    }
});

Upvotes: 2

Related Questions