需要在jstree上下文菜单中检查新节点名称 [英] Need to check new node name in jstree context menu
本文介绍了需要在jstree上下文菜单中检查新节点名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要检查新节点名称(如果已存在于子节点中)。
我的编码如下,
$( #divAssignCategoryDetails)。jstree({
plugins:[ themes, html_data, ui , crrm, contextmenu],
contextmenu:{
items:{ // 可能是一个应该返回像这样的对象的函数
create: false ,
重命名: false ,
ccp: false ,
remove: false ,
类别:{
label: 类别,
act ion: false ,
子菜单:{
创建:{
label: 添加节点,
action:function(obj){
this .create(obj);
}
},
重命名:{
label: < span class =code-string>编辑,
action:function(obj){
this .rename(obj);
}
},
删除:{
label: < span class =code-string>删除,
action:function(obj){
if (confirm( 您确定要删除所选类别吗?)){
this 。除去跨度>(OBJ);
}
}
}
}
}
}
}
});
解决方案
( #divAssignCategoryDetails) .jstree({
plugins:[ themes, html_data , ui, crrm, contextmenu ],
contextmenu:{
items:{ // 可能是一个应该返回像这样的对象的函数
create: false ,
重命名: false ,
ccp: false ,
remove: false ,
类别:{
label : 类别,
action: false ,
子菜单:{
创建:{
label: 添加节点,
action:function(o bj){
this .create(obj);
}
},
重命名:{
label: < span class =code-string>编辑,
action:function(obj){
this .rename(obj);
}
},
删除:{
label: < span class =code-string>删除,
action:function(obj){
if (confirm( 您确定要删除所选类别吗?)){
this 。除去跨度>(OBJ);
}
}
}
}
}
}
}
});
I need to check new node name if already exists in children.
My coding is below,
$("#divAssignCategoryDetails").jstree({
"plugins": ["themes", "html_data", "ui", "crrm", "contextmenu"],
"contextmenu": {
items: { // Could be a function that should return an object like this one
"create": false,
"rename": false,
"ccp": false,
"remove": false,
"Category": {
"label": "Category",
"action": false,
"submenu": {
"Create": {
"label": "Add Node",
"action": function (obj) {
this.create(obj);
}
},
"Rename": {
"label": "Edit",
"action": function (obj) {
this.rename(obj);
}
},
"Delete": {
"label": "Delete",
"action": function (obj) {
if (confirm("Are you sure you wish to delete the selected category?")) {
this.remove(obj);
}
}
}
}
}
}
}
});
解决方案
("#divAssignCategoryDetails").jstree({ "plugins": ["themes", "html_data", "ui", "crrm", "contextmenu"], "contextmenu": { items: { // Could be a function that should return an object like this one "create": false, "rename": false, "ccp": false, "remove": false, "Category": { "label": "Category", "action": false, "submenu": { "Create": { "label": "Add Node", "action": function (obj) { this.create(obj); } }, "Rename": { "label": "Edit", "action": function (obj) { this.rename(obj); } }, "Delete": { "label": "Delete", "action": function (obj) { if (confirm("Are you sure you wish to delete the selected category?")) { this.remove(obj); } } } } } } } });
这篇关于需要在jstree上下文菜单中检查新节点名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文