1.
$(
function
() {
2.
$(
"#demo_1"
).tree({
3.
plugins : {
4.
contextmenu : { }
5.
}
6.
});
7.
});
01.
$(
function
() {
02.
$(
"#demo_2"
).tree({
03.
plugins : {
04.
contextmenu : {
05.
items : {
06.
// get rid of the remove item
07.
remove :
false
,
08.
// add an item of our own
09.
my_act : {
10.
label :
"My own action"
,
11.
icon :
""
,
// you can set this to a classname or a path to an icon like ./myimage.gif
12.
visible :
function
(NODE, TREE_OBJ) {
13.
// this action will be disabled if more than one node is selected
14.
if
(NODE.length != 1)
return
0;
15.
// this action will not be in the list if condition is met
16.
if
(TREE_OBJ.get_text(NODE) ==
"Child node 1"
)
return
-1;
17.
// otherwise - OK
18.
return
1;
19.
},
20.
action :
function
(NODE, TREE_OBJ) {
21.
alert(TREE_OBJ.get(NODE,
"xml_nested"
,
false
));
22.
},
23.
separator_before :
true
24.
}
25.
}
26.
}
27.
}
28.
});
29.
});