该节点将从花式树中删除。我也在检查父节点的ID。该节点不应从花式树中删除。
var userRsId = $('#lstRsId').val();
var autoUserRsId = userRsId.split(",");
if(stringHasValue(autoUserRsId)){
$("#treePanel #userGrpProfileAttribute").fancytree("getRootNode").visit(function(node1){
var rsid = node1.data.rsid;
var noChildNode = true;
if(node1.hasChildren()){
noChildNode = false;
}
var checkExists = autoUserRsId.includes(rsid);
var ParentId = node1.parent.data.rsid;
var checkParentExists = autoUserRsId.includes(ParentId);
if(checkExists == false && checkParentExists==false && noChildNode == true ) {
var usergroupParent = node1.data.topparent;
if(document.getElementById('userGroupSel'+usergroupParent)){
$('#userGroupSel'+usergroupParent).remove();
}
}
});
}
$('#userGrpProfileAttribute').fancytree({});