0

我正在使用jstree jquery 插件来显示和管理树。这是json数据:

0: {id:35, name:amrs trade, parent_id:null}
1: {id:36, name:trips, parent_id:35}
2: {id:37, name:tribute, parent_id:null}
3: {id:38, name:music, parent_id:null}
4: {id:39, name:recordings, parent_id:38}
5: {id:40, name:live shows, parent_id:38}
6: {id:41, name:others, parent_id:null}
7: {id:42, name:investments, parent_id:null}
8: {id:43, name:gold & silver, parent_id:42}
9: {id:44, name:debentures, parent_id:42}
10: {id:46, name:production, parent_id:35}
11: {id:54, name:real estate, parent_id:42}

我用来创建渲染我的树:

$("#incomeCategoryTree").jstree({
    "json_data" : {
        "data" : income,
        "progressive_render" : true
    },
    "plugins" : [ "themes", "json_data" ]
})

我想显示树并让它最初打开一些选定的节点(现在,只显示顶层,隐藏所有非顶层节点)。我可以在上面的 json 中添加什么选项以使 jstree 最初扩展选定的节点?

4

1 回答 1

0

状态:open/closed完成工作:

0: {id:35, name:amrs trade, parent_id:null, state:open}
1: {id:36, name:trips, parent_id:35}
2: {id:37, name:tribute, parent_id:null}
3: {id:38, name:music, parent_id:null}
4: {id:39, name:recordings, parent_id:38}
5: {id:40, name:live shows, parent_id:38}
6: {id:41, name:others, parent_id:null}
7: {id:42, name:investments, parent_id:null, state:closed}
8: {id:43, name:gold & silver, parent_id:42}
9: {id:44, name:debentures, parent_id:42}
10: {id:46, name:production, parent_id:35}
11: {id:54, name:real estate, parent_id:42}
于 2013-04-05T20:43:29.600 回答