View Full Version : How to listen for custom events fired in application

25 Jan 2012, 4:35 AM

I am just switching in the PR4 release into my application, and am restructuring my controller files as per the latest documentation.

I have a logout event being fired in my application, and in PR3 I would do something like this in the controller:

this._application.on( { 'logout': function() {

},scope: this});

I can still do this in PR4, but also note from the documentation I could setup a listeners config object like so:

listeners: {
logout: { fn: this._logoutHandler, scope: this }

But this wont work for me, can I use this listeners object to listen for custom events?

25 Jan 2012, 10:34 AM
That should work, but just remember that he listeners must still be added onto the application instance, and not your controller (which is where they would be going if you put them inside the config: {} block). You should so something like this in your controller:

logout: this.logoutHandler,
scope: this

15 Feb 2012, 10:53 AM

I have the exact same question (problem). I have an application that contains a list, and I was hopeful to have that list's selection event fire out to an application-level listener (because they all fire a common routine).

name: 'test',
launch: function() {
Ext.create("Ext.Panel", {
fullscreen: true,
layout: 'vbox',
items: [
xtype: 'list',
flex: 5,

store: new Ext.data.Store({

listeners: {
select: function( view, record ) {
this.fireEvent( 'galleryLoad' );

Where would I add the app-level listener to listen to the galleryLoad event?

Thanks again.