Book Image

Ext JS Application Development Blueprints

Book Image

Ext JS Application Development Blueprints

Overview of this book

Table of Contents (18 chapters)
Ext JS Application Development Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 this.listen, which contains a component property; this indicates we are configuring the Component Event Domain. Inside here, we use two selectors...