jsTree树中的数据加载有两种模式一种是通过ajax动态加载另外一种是通过json进行“树”的填充,下面对比两种加载方式的差异
1.ajax“树”的填充:
$("#using_json_2").jstree({
"core": {
"data": {
'url': function (node) { //动态加载数据
return rootPath + "/api/org/jstree?id=" + node.id;
}
}
},
"checkbox": {
"keep_selected_style": true
// "three_state": false //父子级别级联选择 状态为false时候只能为单选
},
"plugins": ["checkbox"]
});
通过这种方式加载有一个弊端就是父级节点不能展开,需要点击父节点后才能加载子节点,这样对于用户查看时候的界面不是很友好。
2.JSON“树”的填充:
$('#using_json_2').jstree({
'core' : {
'data' : [