我有TreePanel和听众:
listeners: {
contextmenu: function(node) {
if(node === tree.getRootNode())
contextMenu.items.get(1).setDisabled(true);
else
contextMenu.items.get(1).setDisabled(false);
contextMenu.show(node.ui.getEl());
}}
我有上下文菜单。
var contextMenu = new Ext.menu.Menu({
items: [{
text: 'Add',
icon: './static/ExtJS/images/default/dd/drop-add.gif',
handler: function(item, checked){}, {
text: "Remove",
icon: "./static/ExtJS/images/default/dd/drop-no.gif",
handler: function(item){
}}]
});
我如何进入处理程序Node应该在哪里添加新节点?
答案 0 :(得分:1)
只需将节点存储在某处:
contextMenu.activeNode = node;
contextMenu.show();
// In the handler
handler: function(item) {
var node = item.ownerCt.activeNode
}