1
如何在jstree實例(即具有未知級別的兒童節點的節點)中添加分支。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);
但它失敗!孩子沒有創造。