3
我有以下代码:jstree - 如何获取实例?
model.tree = $('#container').jstree({
'core': { 'data': r, 'check_callback': true },
'plugins': ["themes", "json_data", "ui", "crrm", "contextmenu", "dnd", "types"],
'contextmenu': {
"select_node": "true",
"items": function($node) {
return {
create: {
'label': "Create",
'action': function(obj) {
this.create(obj); // this = Window
model.tree.create(obj); // model.tree doesnt contain "create" method
}
},
};
}
},
});
我写喜欢的例子所示的真实文本菜单创建行动自定义处理程序,但我不能叫this.create“本”是Window对象。此外,我试图用我的jstree实例来调用“创建”,但它也不包含该方法。
我该如何调用“create”方法来创建节点?谢谢。