PrimeNg 组织结构图:删除选定节点

问题描述

我正在尝试从组织结构图中删除选定的节点。但是,当我尝试使用下面的代码获取父级时,它给了我“未定义”。

    deleteChildNode() {
    console.log("Parent : " + this.selectedParent.parent);
    // console.log("Parent Childs: " + this.selectedParent.parent.children);

    if (this.selectedParent && this.selectedParent.parent) {
      let index = this.selectedParent.parent.children.indexOf(this.selectedParent);
      this.selectedParent.parent.children.splice(index,1);
      console.log("Deleted Node");
    }
    this.cd.detectChanges();
  }

还有其他方法可以以编程方式删除选定的 TreeNode 吗?

对于前。我想删除负载均衡器”。因此,父“Infra”将只有“EC2”。

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)