jstree 1.0 如何去掉默认右键菜单中的 edit 子菜单?

jstree 1.0 如何去掉默认右键菜单中的 edit 子菜单?

问题描述:

jstree 1.0 如何去掉默认右键菜单中的 edit 子菜单?如何取消全部的默认菜单,然后自己添加一个自定义的菜单?如何取消已有右键菜单中的某一项菜单?

谢谢!

1、右键菜单需要配置插件contextmenu
默认右键功能:"plugins" : [ "themes", "html_data", "contextmenu" ]

无右键功能:"plugins" : [ "themes", "html_data" ]
这种情况会弹出为网页的右键菜单

2、去掉右键菜单,只要将相应的默认菜单项设为null
[code="javascript"]
$(function () {
$("#demo1").jstree({
"plugins" : [ "themes", "html_data", "contextmenu" ],
"contextmenu": {
"items": {
"create": null,
"rename": null,
"remove": null,
"ccp": null
}
}
});
});
[/code]

3、自定义右键菜单
[code="javascript"]
$(function () {
$("#demo1").jstree({
"plugins" : [ "themes", "html_data", "contextmenu" ],
"contextmenu": {
"items": {
"create": null,
"rename": null,
"remove": null,
"ccp": null,
"弹出对话框": {
"label": "弹出对话框",
"action": function (obj) { alert(obj) }
},
"包含子级菜单": {
"label": "包含子级菜单",
"submenu": {
"cut" : {
"separator_before" : false,
"separator_after" : false,
"label" : "Cut",
"action" : function (obj) { alert("Cut") }
}
}
}
}
}
});
});
[/code]

4、相关网站、文档
官方网站
http://www.jstree.com/
官方文档,最下方有各种插件的说明
http://www.jstree.com/documentation
右键菜单说明
http://www.jstree.com/documentation/contextmenu

多看看官方的示例代码和文档,下载的包中有示例代码,慢慢研究就懂了