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

Insert node at specific index under parent node.Iindex #930

Open
amitmankotia opened this issue Jul 3, 2022 · 1 comment
Open

Insert node at specific index under parent node.Iindex #930

amitmankotia opened this issue Jul 3, 2022 · 1 comment

Comments

@amitmankotia
Copy link

amitmankotia commented Jul 3, 2022

I am using react-sortable-tree in my application to create a funnel. I have a use case where I have a two buttons on child node to create another node under and above it. I need a method where I can pass parentKey and index so that new node is create under parent at specific index.

image

I did not find any function like addNodeUnderParentAtIndex which can do so.

Any help on how this can be done is appreciated!

@ths-somebody
Copy link

You will need to create a clone the parent and place the new node the cloned parent node children. Then update the tree with this new parent node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants