1. #1
    Sencha Premium Member Zdeno's Avatar
    Join Date
    Nov 2009
    Location
    Prague
    Posts
    548
    Vote Rating
    36
    Zdeno has a spectacular aura about Zdeno has a spectacular aura about

      0  

    Default Ext.ux.tab.ContextMenu plugin

    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,197
    Vote Rating
    482
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Thank you for sharing.

    Scott.

Thread Participants: 1