Search code examples
javascriptextjsdom-eventsextjs4.1

Override button class with event listener EXTJS


I'm using EXTJS 4 and using the Button class. With it I don't have access to the dblclick event listener. Is there a way I can add this listener as an attribute to the button class?

Ext.define('MemOS.controller.Icon', {
    extend: 'Ext.app.Controller',

    models: ['Icon'],
    stores: ['Icons'],
    views: ['Icon'],
    refs: [{
        ref: 'icon',
        selector: 'icon'
    }],

    init: function () {
        this.control({          
            icon: {
                click: function(c) {
                    Ext.create('MemOS.view.Window', {
                        title: 'Project',
                        items: [{
                            xtype: 'projectsgrid'
                        }]
                    }).show();
                }
            }
        });
    },
});

Solution

  • You can use the clickEvent property: http://docs.sencha.com/ext-js/4-1/#!/api/Ext.button.Button-cfg-clickEvent