如何在 jstree 实例中添加分支(即具有未知级别子节点的节点)。
// example of a branch (with one level)
var branch = {
"data":"Folder 1",
"attr":{"rel":"Layer","elt":1},
"state":"closed",
"children":[
{
"data":"Item 4",
"attr":{"rel":"File 1","elt":2},
"state":"",
"children":null
}
]
};
并将此分支添加到 jstree 实例中:
// -1 means root
$.jstree._reference('#tree').create_node(-1, 'last', branch, false, false);
但它失败了!孩子不是被创造出来的。