在jsTree中,我使用复选框补码及其以下的three_state属性进行以下操作: 否,但是我想在数据加载完成时更新属性 three_state为true,请查看文档,而我仅找到如何更新树的数据,而不是补数的属性。 我正在尝试这样做,但是不起作用
$.ajax({
async: true,
type: "POST",
url: "/Perfiles/GetTreeData",
dataType: "json",
success: function (data) {
createJSTrees(data);
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
},
complete: function () {
$('#onflycheckboxes').jstree({
checkbox: {
three_state: true
},
plugins: ["themes", "types", "json_data", "ui",
"checkbox", "children"]
})
}
});
function createJSTrees(jsondata) {
$('#onflycheckboxes').jstree({
'core': {
'data': jsondata,
"check_callback": true
},
"types": {
"default": {
"icon": "fa fa-folder"
},
},
checkbox: {
keep_selected_style: true,
three_state: true
},
"children": [{
"state": { "selected": true },
"icon": "fa fa-file"
}],
plugins: ["themes", "types", "json_data", "ui",
"checkbox", "children"]
});
}
答案 0 :(得分:0)
您需要将true
传递给jstree函数以获取树的现有实例。在此实例上,您可以更新树的属性。
$('#onflycheckboxes').jstree(true).checkbox.three_state = true;