Results 1 to 5 of 5

Thread: How to handle 'activate' event in a ViewController

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha - Sales Team
    Join Date
    Feb 2012
    Location
    Fort Myers, Florida
    Posts
    42

    Default Answered: How to handle 'activate' event in a ViewController

    trying to check out the new ViewController against a view in my app and I would like to trap the view's 'activate' event - is there an example of how to do this?

  2. Code:
    Ext.require('*');
    
    Ext.define('MyController', {
        extend: 'Ext.app.ViewController',
        alias: 'controller.my',
    
        onActivate: function() {
            console.log('Go', this.getView().title);
        }
    });
    
    Ext.define('MyView', {
        extend: 'Ext.panel.Panel',
        alias: 'widget.my',
        controller: 'my',
        listeners: {
            scope: 'this',
            activate: 'onActivate'
        }
    })
    
    Ext.onReady(function() {
    
        new Ext.tab.Panel({
            width: 600,
            height: 300,
            renderTo: document.body,
            defaultType: 'my',
            items: [{
                title: 'T1',
                html: 1
            }, {
                title: 'T2',
                html: 2
            }, {
                title: 'T3',
                html: 3
            }, {
                title: 'T4',
                html: 4
            }, {
                title: 'T5',
                html: 5
            }]
        });
    });

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •