View: {
ShowLine: true,
SelectedMulti: false,
DblClickExpand: false
},
Data: {
SimpleData: {
Enable: true
}
},
The callback: {
OnNodeCreated: enclosing onNodeCreated,
BeforeClick: enclosing beforeClick,
The onClick: enclosing the onClick
}
};
Var zNodes=[{
Id: 1,
PId: 0,
Name: "1" main menu,
Open: true
}, {
Id: 11,
PId: 1,
Name: "submenu 1-1"
}, {
Id: 111,
PId: 11,
Name: "leaf node 1-1-1
"}, {
Id: 112,
PId: 11,
Name: "leaf node 1-1-2
"}, {
Id: 113,
PId: 11,
Name: "leaf node 1-1-3
"}, {
Id: 114,
PId: 11,
Name: "leaf node 1-1-4
"}, {
Id: 12,
PId: 1,
Name: "submenu 1-2"
}, {
Id: 121,
PId: 12,
Name: "leaf node 1-2-1
"}, {
Id: 122,
PId: 12,
Name: "leaf node 1-2-2
"}, {
Id: 123,
PId: 12,
Name: "leaf node 1-2-3
"}, {
Id: 124,
PId: 12,
Name: "leaf node 1-2-4
"}, {
Id: 2,
PId: 0,
Name: "the main menu 2"
}, {
Id: 21,
PId: 2,
Name: "submenu 2-1"
}, {
Id: 211,
PId: 21,
Name: "leaf node 2-1-1
"}, {
Id: 212,
PId: 21,
Name: "leaf node 2-1-2
"}, {
Id: 213,
PId: 21,
Name: "leaf node 2-1-3
"}, {
Id: 214,
PId: 21,
Name: "leaf node 2-1-4
"}, {
Id: 22,
PId: 2,
Name: "sub menu 2-2"
}, {
Id: 221,
PId: 22,
Name: "leaf node 2-2-1
"}, {
Id: 222,
PId: 22,
Name: "leaf node 2-2-2
"}, {
Id: 223,
PId: 22,
Name: "leaf node 2-2-3
"}, {
Id: 224,
PId: 22,
Name: "leaf node 2-2-4
"}, {
Id: 3,
PId: 0,
Name: "three main menu"
}, {
Id: 31,
PId: 3,
Name: "submenu 3-1"
}, {
Id: 311,
PId: 31,
Name: "leaf node 3-1-1
"}, {
Id: 312,
PId: 31,
Name: "leaf node 3-1-2
"}, {
Id: 313,
PId: 31,
Name: "leaf node 3-1-3
"}, {
Id: 314,
PId: 31,
Name: "leaf node 3-1-4
"}, {
Id: 32,
PId: 3,
Name: "submenu 3-2"
}, {
Id: 321,
PId: 32,
Name: "leaf node 3-2-1
"}, {
Id: 322,
PId: 32,
Name: "leaf node 3-2-2
"}, {
Id: 323,
PId: 32,
Name: "leaf node 3-2-3
"}, {
Id: 324,
PId: 32,
Name: "leaf node 3-2-4
"}];
The function beforeClick (treeId, node) {
If (node. IsParent) {
If (the node level===0) {
Var pNode=curMenu;
While (pNode & amp; & PNode level!==0) {
PNode=pNode. GetParentNode ();
}
If (pNode!=={
node)Var a=$(" # "+ pNode. Dar +" _a ");
A.r emoveClass (" cur ");
ZTree_Menu. ExpandNode (pNode, false);
}
A=$(" # "+ node. Dar +" _a ");
A.a ddClass (" cur ");
Var isOpen=false;
For (var I=0, l=node. Children. Length; i
IsOpen=true;
break;
}
}
If (isOpen) {
ZTree_Menu. ExpandNode (node, true);
CurMenu=node;
} else {
ZTree_Menu. ExpandNode (node. Children [0]. IsParent? Node. The children [0] : node, true);
CurMenu=node. Children [0];
}
} else {
ZTree_Menu. ExpandNode (node);
}
}
return ! Node. IsParent;
}
The function onClick (e, treeId, node) {
Xadmin. Add_tab (' tertiary regional linkage ', 'city. HTML)
}
Xadmin. Add_tab (' tertiary regional linkage ', 'city. HTML) that is the way I want to call, could you tell me how to modify the refs let every child can call a different name and the page address
CodePudding user response:
Can you get event sources from event object?function onClick (e, treeId, node) {
Var obj=e. arget;//get the event source
Xadmin. Add_tab (obj. Name, XXX);
}