jstree设置了checkbox.tie_selection为true,但是调用select_node()时依然会将该节点的所有子节点都选中,如下所示:
tree = $('#districttree').jstree({
"plugins" : ["wholerow","checkbox"],
"core": {
'strings' : {
'Loading ...' : '加载中...'
},
'data' : {
"url" : '/api/users/getOrgTree',
"dataType" : "json",
"data" : function (node) {
var pid = node.id;
if(pid == "#"){
pid = null;
}
return {"orgId": pid, "deep": 1};
}
},
fix : function (data) {
var pNode = data;
for (var i in pNode.children) {
var sNode = pNode.children[i];
}
return data;
},
"themes" : {
"icons" : false
},
"dblclick_toggle" : false,
"worker" : false
},
"checkbox":{
"tie_selection":true,
"whole_node":true,
"keep_selected_style":false
}
})
使用了tree.jstree().select_node(nodeChecked[i]);
后效果如下:
希望效果如下:
设置checkbox的cascade: 'undetermined|up|down'分别试试,你说的效果undetermined应该可以实现