An event domain example

Let's go back to our MVVM album example we created earlier. Our view had handler and listener configurations that tied view events to event handlers that we put in our view controller. However, event domains allow us to remove this tie and give all of the control to the view component. In view/album/Album.js in our previous example, we can remove the listener config on the grid and the handler on the button and then add the following code to view/album/AlbumController.js:

init: function() {
    this.listen({
        component: {
            'app-album grid': {
               'rowdblclick': 'onAlbumDblClick'
            },
            'app-album button': {
               'click': 'onShowSummary'
            }
        }
    });
}, 

This is slightly more verbose, so look at what exactly is happening here. We pass an object to ...

Get Ext JS Application Development Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.