【发布时间】:2020-05-05 15:54:39
【问题描述】:
我想知道,如何在 JsTree 上加载新数据,我必须像这样在点击时加载数据:
function showTree(group_id){
$("#jstree").jstree({
"core": {
"themes": {
'name': 'proton',
'responsive': true
},
"data": {
type: "POST",
url: "/menu/tree",
dataType: "json",
data: {
group_id: group_id
},
success: function (data) {
data.d;
console.log(data);
$(data).each(function () {
return { "id": this.id };
});
}
},
},
"checkbox" : {
"keep_selected_style" : false
},
"plugins" : [ "checkbox" , "types", "json_data"]
});
}
当我第一次调用函数时它的工作但第二次使用不同的数据时数据不会改变。
注意:不同的数据来自检查值
数据示例: 新:
{
id : "1"
text : "Test 1"
state : {
selected : true
},
}
{
id : "2"
text : "Test 2"
state : {
selected : false
},
}
我改成:
{
id : "1"
text : "Test 1"
state : {
selected : false
},
}
{
id : "2"
text : "Test 2"
state : {
selected : false
},
}
我可以只更改从 JsTree 中选择的数据吗?
【问题讨论】: