如何禁用jsTree右鍵單擊上下文菜單的「複製」(但不是剪切/粘貼)功能?禁用在CCP上下文菜單中複製JsTree
0
A
回答
1
這幾乎沒有訣竅。
$("#housingTree").jstree({
"plugins": ["themes", "html_data", "ui", "crrm", "hotkeys", "contextmenu"],
"core": { "initially_open": ["phtml_1"] },
"contextmenu": {
"items": function ($node) {
return {
"Rename": {
"label": "Rename",
"action": function (obj) { this.rename(obj); }
},
"Create": {
"label": "Create",
"action": function (obj) { this.create(obj); }
},
"Delete": {
"label": "Delete",
"action": function (obj) { this.remove(obj); }
},
"Cut": {
"label": "Cut",
"action": function (obj) { this.cut(obj); }
},
"Paste": {
"label": "Paste",
"action": function (obj) { this.paste(obj); }
}
};
}
}
})
1
我不知道如果動作函數是默認函數或自定義函數,但那不適合我......反正你的文章確實讓我在正確的路徑!謝謝!
這是我做的,找到另一篇文章後:
"contextmenu": {
"items": function ($node) {
var tree = $("#html1Tree").jstree(true);
return {
"Rename": {
"label": "Rename",
"action": function (obj) {
tree.edit($node);
}
},
"Create": {
"label": "Create",
"action": function (obj) {
$node = tree.create_node($node);
tree.edit($node);
}
}
};
}
}
1
較短的做法可能是
"contextmenu": {
"items": function(node) {
var defaultItems = $.jstree.defaults.contextmenu.items();
console.log("default items : "+JSON.stringify(defaultItems));
delete defaultItems.ccp.submenu.copy;
return defaultItems;
}
},
可以CONSOLE.LOG(defaultItems)。它將打印對象的json表示。您也可以修改其他屬性。
相關問題
- 1. jstree上下文菜單不工作
- 2. jstree上下文菜單動作評估
- 3. 在jsTree上下文菜單中創建自定義項目
- 4. 禁用上下文菜單時的EditText
- 5. jquery上下文菜單禁用輸入
- 6. 禁用整個上下文菜單
- 7. devexpress wpf gridcontrol禁用上下文菜單
- 8. 禁用DataGridView系統上下文菜單
- 9. AIR - 禁用上下文菜單
- 10. 禁用點擊上下文菜單項
- 11. 禁用上下文菜單WPF
- 12. 如何禁用Qt中禁用QScrollbar上下文菜單(Windows XP)
- 13. 禁用基於WPF複選框的值的上下文菜單
- 14. jstree從上下文菜單中刪除默認元素
- 15. jsTree中零大小的上下文菜單
- 16. TypeScript中的JsTree自定義上下文菜單
- 17. 限制上下文菜單
- 18. 在tvOS上禁用AVPlayer下拉菜單
- 19. 禁用文本框上的複製/粘貼菜單彈出?
- 20. 在jsf中使用javascript禁用動態上下文菜單
- 21. JSTree中的Ajax調用綁定在「create.jstree」上下文菜單不起作用
- 22. jquery上下文菜單禁用菜單項
- 23. 在Chrome上的本地主機上禁用上下文菜單
- 24. 在上下文菜單中禁用multicheck wpf
- 25. 設置在Flash上下文菜單中禁用
- 26. 如何在上下文菜單中動態禁用ToolStripMenuItem?
- 27. 在Flash中禁用上下文菜單和鼠標
- 28. 如何禁用JavaScript中的右鍵單擊上下文菜單
- 29. 通過Webbrowser在PDF查看器上禁用上下文菜單
- 30. 在上下文菜單上禁用彈出窗口?