JsTree: add child node dynamically

I use the code below at page load time to generate a tree using jsTree .

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

Everything works fine, and the result array is displayed as tree. I want to add / add dynamically child nodes by clicking several nodes in this static tree.

Please, help.

+2
source share
2 answers

If you set the property childrenfor a specific node to true, then the node appears as private, and when the node expands, the functions core.data.dataand are called core.data.url(it is assumed that you are using AJAX).

AJAX http://www.jstree.com/docs/json/

core.data, .

+2

jsTree API, .

get_children_dom (obj)

draw_children(node)private

, node .

0

All Articles