最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - JsTree how to create a root node - Stack Overflow

programmeradmin5浏览0评论

How to create a root node using 'create' method

Root
 |___ Child1
 |___ Child2

I am using JsTree, by using 'json_data' I can able to create nodes, but I want to create all nodes dynamically using 'create' method.

Please help me....

How to create a root node using 'create' method

Root
 |___ Child1
 |___ Child2

I am using JsTree, by using 'json_data' I can able to create nodes, but I want to create all nodes dynamically using 'create' method.

Please help me....

Share Improve this question asked Aug 1, 2012 at 9:14 sokidsokid 8134 gold badges10 silver badges17 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 11

As of version 3.0.0-beta10 of jsTree, to create a top-level node, the reference for the parent is "#". For example:

$("#jstree").jstree('create_node', '#', {'id' : 'myId', 'text' : 'My Text'}, 'last');

The older answer given here didn't work with that version of jsTree.

Maybe it is what you are looking for:

$("#tree").jstree("create", -1, false, "Name", false, true);
发布评论

评论列表(0)

  1. 暂无评论