I setup this contextmenu
$('#myJsTree'). { .....
, 'contextmenu': {
'items': function (node) {
if (mode != "Open") {
var tmp = $.jstree.defaults.contextmenu.items();
delete tmp.rename;
delete tmp.remove;
delete tmp.ccp;
tmp.create.label = "New Folder";
tmp.create.action = function (dta) {
console.log("so far so good");
$('#myJsTree').trigger('create_node.jstree', dta);
}
return tmp;
}
}
});
to trigger this event
$('#myJsTree').on('create_node.jstree', function (e, dta) {
console.log("dta", dta);
});
And everything seems to so okay but the console also logs:
so far so good
as expected, and
dta Object {item: Object, reference: n.fn.init1, element: n.fn.init1, position: Object}
as expected. But also,
jstree.min.js:5 Uncaught TypeError: Cannot read property 'parent' of undefined
at a.jstree.plugins.contextmenu. (jstree.min.js:5)
at HTMLDivElement.d (jquery.js:2)
at HTMLDivElement.dispatch (jquery.js:3)
at HTMLDivElement.r.handle (jquery.js:3)
at Object.trigger (jquery.js:3)
at HTMLDivElement. (jquery.js:3)
at Function.each (jquery.js:2)
at n.fn.init.each (jquery.js:2)
at n.fn.init.trigger (jquery.js:3)
I can't understand why the error or what to do about it.
Any help appreciated.