I have a jsTree using the json data format. Loading the root nodeset is fine.
My problem is how to append child nodes to the parent node that was clicked.
ANY help would be appreciated.
感谢!
$("#tree-cat1")
.bind("open_node.jstree", function (event, data) {
console.log(data.rslt.obj.attr("id"));
//eval(loadChild());
//at this point i need to append the result of loadChild() to the tree under the relevant node
})
.jstree({
"json_data": {
"data": eval(loadRoot())
},
"themes": {"theme": "classic","dots": true,"icons": true},
"plugins": ["themes", "json_data", "ui"]
})
function loadRoot() {
return "[{ data : A node , state : closed , attr :{ id : A }}]";
}
function loadChild() {
return "[{ data : A1 node , attr :{ id : A1 }}]";
}