1

I try to create a node dynamically, the closes I got is:

$('#jstree_cats_div').jstree(
    "create_node", parent, position, newNode, false, false);

which throws an exception:

TypeError: Object #<Object> has no method 'match'

I couldn't find any working example... all the jsfiddel example on other questions are not working, seems like they all using old API (my guess)

also the 'create' in the demo in jsTree web site http://www.jstree.com/demo doesn't work.

Please supply a working example of adding a node dynamically.

Thanks

Elia Weiss
  • 8,324
  • 13
  • 70
  • 110
  • I can add nodes to the child, but not to the root in the demo on the jstree website. – atmelino May 19 '14 at 03:57
  • here's what I did (uses contextmenu and structured json data not just a text node) - http://jsfiddle.net/6L7twnka/1/ – frumbert Oct 14 '14 at 10:08

1 Answers1

1

Try this:

var tree = $('#jstree_cats_div').jstree(true);
tree.jstree("create_node", parent, position, newNode, false, false);

You can see here my solution: jsTree and Context Menu: modify items

It's for Context Menu but you can see the function...

Community
  • 1
  • 1
narcolepticvolcano
  • 1,037
  • 1
  • 10
  • 25