jsTree - cannot create new node - all other functions work well
jstree
Solution
First, in order for changes to be made to the tree, checkcallback in core config need to be set to true.
$('#test_tree').jstree({
'core' : {
'data' : {
'url' : 'info.json',
'data' : function (node) {
return { 'id' : node.id };
},
check_callback : true
}
}
You need to at least pass the parent.id to the create_node function.
$.jstree.reference('#test_tree').create_node('ajson1');
You could check the API at the jstree website for the full parameter list.
Problem
Deselect and hover funcntions work fina but create/delete/rename don't. What do is do wrong? info.json contains 5 nodes marked from 1 to 5. ``` <head> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <link rel="stylesheet" href="jstree\dist\themes\default\style.min.css" /> <script src="jstree\dist\jstree.js"></script> <script> $(function() { $('#test_tree').jstree({ 'core' : { 'data' : { 'url' : 'info.json', 'data' : function (node) { return { 'id' : node.id }; } } } }); }); </script> </head> <body> <div id="container" > <div id="nav_bar"> <button id="create" onclick = "demo_create()">Create</button> </div> <div id="test_tree"></div </div> <script> function demo_create() { $.jstree.reference('#test_tree').hover_node('ajson5'); $.jstree.reference('#test_tree').deselect_node('ajson1'); $.jstree.reference('#test_tree').create_node(); }; </script> </body> ``` I used same example from official site but it doesn't work Thanks for any help.