1. #1
    Sencha Premium Member Zdeno's Avatar
    Join Date
    Nov 2009
    Location
    Prague
    Posts
    747
    Vote Rating
    70
    Zdeno is just really nice Zdeno is just really nice Zdeno is just really nice Zdeno is just really nice

      0  

    Default Ext.ux.tab.ContextMenu plugin

    Simple plugin for everybody who needs convert from Ext 3 to Ext 4 and miss contextmenu event e.g. for right click on Tab

    Code:
    Ext.define('Ext.ux.tab.ContextMenu', {
        alias : 'plugin.tabcontextmenu',
        mixins : {
            observable : 'Ext.util.Observable'
        },
    
    
        init : function(tabpanel) {
            this.tabPanel = tabpanel;
            this.tabPanel.addEvents('contextmenu');
            this.tabBar = tabpanel.down("tabbar");
    
    
            this.mon(this.tabPanel, {
                scope : this,
                afterlayout : this.onAfterLayout,
                single : true
            });
        },
        
        onAfterLayout : function() {
            this.mon(this.tabBar.el, {
                scope : this,
                contextmenu : this.onContextMenu,
                delegate : 'div.x-tab'
            });
        },
        
        onContextMenu : function(event, target) {
            var me = this,
                tab = me.tabBar.getChildByElement(target);
            
            event.preventDefault();
            this.tabPanel.fireEvent('contextmenu', this.tabPanel, tab, event, target);
        }
    });

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,385
    Vote Rating
    498
    scottmartin is a jewel in the rough scottmartin is a jewel in the rough scottmartin is a jewel in the rough scottmartin is a jewel in the rough

      0  

    Default

    Thank you for sharing.

    Scott.

Thread Participants: 1