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 eventful application


An interesting observation about both routing and data binding is that they are built around events. When a route changes, an event is fired and a controller listens to it, setting the application's state accordingly. When a property is data bound, Ext JS publishes its changes and other properties listen for these changes.

We're also familiar with events, such as click, select, show, and so on, that are fired from the various Ext JS components. It would seem that as events are being used everywhere in an Ext JS application, we might as well make use of them ourselves!

We can use fireEvent from every Observable class in Ext JS. This allows you to fire a custom event from pretty much anywhere in our application. In previous versions of Ext JS, you needed to define events beforehand using an addEvent method, but this is no longer the case. However, what use is this? Does it offer a real-world advantage? Let's look at some bad code to demonstrate:

// Theoretical "messages...