O'Reilly logo

Sencha Touch 2 Mobile JavaScript Framework by Bryan P. Johnson, John Earl Clark

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting more out of events

Now that we have seen how events and controllers fit together, we need to take a look at the other uses and options available to us with events.

Custom events

While Sencha Touch components respond to a large number of events, it can sometimes be helpful to fire custom events within your application.

For example, you could fire a custom event called vikinginvasion, which might trigger additional actions within your application. For this example, we will assume we have a component called cmp. We can fire events with this component simply by calling:

cmp.fireEvent('vikinginvasion');

You can then add a listener to any component in the control section of your controller for vikinginvasion, along with a function to handle the event. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required