extjs tree panel context menu not working

前端 未结 2 2317
说谎
说谎 2021-02-20 05:06
var menu1 = new Ext.menu.Menu({
    items: [{
        text: \'Open in new tab\'

    }]
});
var treePanel = Ext.create(\'Ext.tree.Panel\', {
    id: \'tree-panel\',
             


        
2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-20 05:12

    Tree doesn't have contextmenu event in ExtJS4.

    You should use itemcontextmenu instead of contextmenu:

    treePanel.on('itemcontextmenu', function(view, record, item, index, event) {
        alert(record)
        //treePanelCurrentNode = record;
        menu1.showAt(event.getXY());
        event.stopEvent();
    }, this);
    

提交回复
热议问题