Ext JS Learning 2

by amoiseev

HTML

<link rel="stylesheet" href="http://dev.sencha.com/deploy/ext-4.0.7-gpl/resources/css/ext-all.css">
<button id="refresh">Refresh</button>

JavaScript

Ext.define('Fast.controller.Tasks', {
    extend : 'Ext.app.Controller',
    
    init : function() {
        this.application.on('refresh', function() {
            console.log('button clicked');
        });
    }
});

Ext.define('Fast.controller.Toolbar', {
    extend : 'Ext.app.Controller',
    
    init : function() {
        // Bind pure DOM event to controller's handlers
        Ext.Element.get('refresh').on('click',function() {
            this.application.fireEvent('refresh');
        }, this);
    }
});

Ext.application({
    name : 'Fast',
    
    controllers : ['Tasks', 'Toolbar'],
    
    launch : function() {
    }
});