Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

programmatically add Node in jstree

I am trying to add a new node in jstree programmatically on button click, as well as on contextmenu create click, but there is some issue.

Here is the link of fiddle.

<div id="jstree">
  </div>
<button id="sam">create node</button>
like image 361
Sunil Madan Avatar asked Apr 24 '15 12:04

Sunil Madan


1 Answers

Here is your fiddle, fixed to work: http://jsfiddle.net/3q9Ma/223/

You were calling create_node with an array, which was wrong, also the string value 'null' was not the correct way to create a root node - use the special string value '#' (in later versions null works too, but not as a string).

You might consider upgrading the jstree version - your fiddle was using a very early beta. Also keep in mind jstree itself does not require Angular.

like image 80
vakata Avatar answered Sep 22 '22 09:09

vakata