I am trying to dynamically add a new node in my jsTree container. It is not working at all. I don't know what i am missing.
$("#tree").jstree({
core: {
"animation": 0
},
"html_data": {},
"themes": {
"icons": false
},
"search": {
"case_insensitive": true,
"show_only_matches": true
},
"plugins": ["themes", "html_data", "search"]
});
$("#tree").jstree("create_node", $("node_1"), "after", { "data": "Hello World" });
html:
<div id="tree">
<ul>
<li id="node1"><a>Hello</a></li>
</ul>
</div>
set 'check_callback' : true, otherwise all operations like create, rename are prevented. like so:
this.treeDiv.jstree(
{
'core' : {
'check_callback': true,
'data' : {
'url' : function (node) {
return 'ajax_roots.json';
},
'data' : function (node) {}
}
},
"search" : {
"fuzzy" : false,
"show_only_matches": true,
"close_opened_onclear" : true
},
"plugins" : ["search", "sort", "json_data"]
});