Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nzTree手动添加兄弟节点功能 #5739

Closed
lzc199507 opened this issue Sep 3, 2020 · 0 comments · Fixed by #6161
Closed

nzTree手动添加兄弟节点功能 #5739

lzc199507 opened this issue Sep 3, 2020 · 0 comments · Fixed by #6161
Assignees
Milestone

Comments

@lzc199507
Copy link

What problem does this feature solve?

目前NzTreeNode方法中添加节点的方法只有addChildren, 而使用此方法的前提是,有个Node,即为添加后的node的ParentNode。

现在有个需求,如nzData = [ NzTreeNode1, NzTreeNode2 ] ,要手动添加一个newNode,跟1和2平级的,这个时候因为是最外层,NzTreeNode1 或 NzTreeNode2 的 ParentNode 是 null,所以无法使用addChildren方式添加, 只能通过 nzData = [ ...nzData, newNode ],可是通过修改nzData,会触发treeComponent的ngOnChanges,触发renderTreeProperties进而触发handleNzData,进而导致nzTreeService触发initTree方法,使得之前保存的expanded状态、halfChecked状态、checked状态等,全部丢失。

因此有这个需求,当父节点不存在时,需要有可以添加兄弟节点的方法。

What does the proposed API look like?

类似dom的nextSibling或previousSibling

const node = nzTree.getTreeNodeByKey('key')或其他方式
获取某个node
通过node.addNextSiblingNode(newNode)

@hsuanxyz hsuanxyz added this to the backlog milestone Oct 23, 2020
hsuanxyz added a commit to hsuanxyz/ng-zorro-antd that referenced this issue Dec 8, 2020
hsuanxyz added a commit to hsuanxyz/ng-zorro-antd that referenced this issue Dec 8, 2020
hsuanxyz added a commit to hsuanxyz/ng-zorro-antd that referenced this issue Dec 8, 2020
hsuanxyz added a commit to hsuanxyz/ng-zorro-antd that referenced this issue Dec 8, 2020
hsuanxyz added a commit to hsuanxyz/ng-zorro-antd that referenced this issue Dec 8, 2020
hsuanxyz added a commit to hsuanxyz/ng-zorro-antd that referenced this issue Dec 8, 2020
hsuanxyz added a commit to hsuanxyz/ng-zorro-antd that referenced this issue Dec 8, 2020
hsuanxyz added a commit to hsuanxyz/ng-zorro-antd that referenced this issue Dec 9, 2020
hsuanxyz added a commit to hsuanxyz/ng-zorro-antd that referenced this issue Dec 14, 2020
hsuanxyz added a commit to hsuanxyz/ng-zorro-antd that referenced this issue Dec 16, 2020
hsuanxyz added a commit that referenced this issue Dec 16, 2020
close #5976, close #5809, close #5739, close #5736, close #5519, close #5446, close #5152, close #4694, close #4472, close #3832, close #2785, close #2744, close #6199
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants