Hi,
You can find here:
http://www.jstree.com/documentation/contextmenu
information, that 'items' expects object or function. The function
receives right clicked node and should return object in format as
described in above docs.
The configuration might look like this:
contextmenu: {
items: function (NODE, TREE_OBJ) {
var obj = {};
if ('type1' == NODE.attr('rel')) {
obj['create'] = {
label: 'Create',
action: function() {/*...*/},
//...
}
}
if ('type2' == NODE.attr('rel')) {
obj['rename'] = {
label: 'Rename',
action: function() {/*...*/},
//...
}
}
if ('type2' == NODE.attr('rel') || 'type3' ==
NODE.attr('rel')) {
obj['some_other_action'] = {
label: 'Some other action',
action: function() {/*...*/},
//...
}
}
// etc.
}
return obj;
}
Best regards,
ChrisRaven