简体   繁体   English

想要禁用子菜单extjs上的右键单击事件

[英]Wants to disable right click event on submenu, extjs

I have a menu which has submenu also. 我也有一个包含子菜单的菜单。 Wants to disable the right click event 想要禁用右键单击事件

On menu it is working. 在菜单上它正在工作。 I mean if I right click then nothing happens but same is not applying for submenus 我的意思是,如果我单击鼠标右键,则什么也没有发生,但同样没有申请子菜单

Tried 试过了

{
    text: 'Tools',
    name: 'toolsBtn',
    id:'toolsmenu',
    disabled:true,
    menu: new Ext.menu.Menu({
        id:'menutoolbar',
        items: [{
            text: 'Select some row from the results grid',
        }],
        listeners: {
            render : {
                fn : function(item) {
                    var el = item.getEl();
                    this.el.on("contextmenu", Ext.emptyFn, this, {preventDefault: true});
                }
            }
        }
    })
}

Its working on Menu but not on submenu 它在菜单上起作用,但在子菜单上不起作用

Just add the same listener on your sub-menu: 只需在子菜单上添加相同的侦听器即可:

items: [{
        text: 'Select some row from the results grid',
        listeners: { //your listener
        }
    }]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM