James Zaghini
James Zaghini

Reputation: 4001

Sencha 2: Listeners on a panel not working

I'm trying to port my Sencha app from Sencha1 to Sencha2.

It seems that none of my listeners are working. The documentation for Sencha2 seems to have different events, and a smaller number of events:

http://docs.sencha.com/touch/1-1/#!/api/Ext.Panel

http://docs.sencha.com/touch/2-0/#!/api/Ext.Panel

Is there a new way to do this? Are the listeners from Sencha1 just not implemented in Sencha2 yet?

Ext.define('MyApp.view.Loading', {
        extend: 'Ext.Panel',
        googleAnalyticsName: 'Loading',
        id: 'loadingView',
        xtype: 'loading',
        config: {
            fullscreen: true,
            layout: 'vbox',
            scrollable: false,
            items: [{
                html: '<div id="loading-view" style="background-repeat: none;"><div id="loading-page-spinner"></div>'
            }],
            listeners: {
                activate: function() {
                    console.log('activate listener');
                },
                afterrender: function() {
                    console.log('afterrender listener')             
                }
            },
        },
    });

Upvotes: 3

Views: 5348

Answers (1)

James Zaghini
James Zaghini

Reputation: 4001

This seems to work:

Ext.define('MyApp.view.Loading', {
        extend: 'Ext.Panel',
        googleAnalyticsName: 'Loading',
        id: 'loadingView',
        xtype: 'loading',
        initialize: function() {

            this.on('activate', function() { alert('activate'); } );

            this.callParent();
        }
    ... 

Upvotes: 2

Related Questions