如何在fancytree javascript中查找父级的父级节点(Grand Parent node)

时间:2019-04-08 16:52:00

标签: javascript jquery html css fancytree

该节点将从花式树中删除。我也在检查父节点的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({});

0 个答案:

没有答案