views:

224

answers:

2

Assume I have a menu (Ext.menu.Menu) with some items. When menu is shown user cat right-click on it's item and browser context menu will be shown (with elements like "Save link as...").

How can I disable that browser context menu? Globally in all Ext.menuMenu instances if possible.

A: 

possibly solved

Works for single menu instance:

contextMenu.on('render', function (menu) {
    menu.getEl().on('contextmenu', Ext.emptyFn, null, {preventDefault: true});
});
Sergei Stolyarov
A: 

For all instances you could do it this way:

Ext.override(Ext.menu.Menu, {
    render : function(){
        Ext.menu.Menu.superclass.render.call(this);
        this.el.on("contextmenu", Ext.emptyFn, this, {preventDefault: true});
    }
});

You may also want to do something similar for toolbars if needed.

bmoeskau