2

I am using below code while page load to generate a tree using jsTree.

  $('#jstree_demo_div').jstree({
          'core': {
             'themes': {
                        'name': 'proton',
                        'responsive': true
                        },
             'data': results,
             "check_callback" : true
          }
  });

All is working fine and results array is showing as tree.I want to add /append dynamically child nodes while clicking on few of the nodes in this static tree.

Please help.

A_____
  • 364
  • 3
  • 19

2 Answers2

2

If you set the children property of a particular node to true then the node is rendered as closed, and when the node is expanded then core.data.data and core.data.url functions are called (this is assuming you are using AJAX).

See the docs for using AJAX http://www.jstree.com/docs/json/

Alternatively you can supply a function for core.data which is what is called to load the tree, and any nodes.

samjudson
  • 56,243
  • 7
  • 59
  • 69
0

If you read the jsTree API, you can make use of these below.

get_children_dom (obj)

draw_children(node)private

Learn how to fetch a single child node and draw it.

seoyoochan
  • 822
  • 3
  • 14
  • 28
  • thanks seoyoochan, I want to append multiple node ( lazy load from a different data set /array) to my static tree ( generated on page load) – A_____ Mar 27 '15 at 13:40