How to get `parentKey` to add new node
See original GitHub issueHi,
First of all I really like your implemented stuff, it saves my lot of time. So thanks for implementing this sortable tree, but it would be more better if you can make the documentation more descriptive.
Because I am having issue while using the Data Helper Functions
. I am trying to use the addNodeUnderParent(treeData, newNode, parentKey)
but dont know how to get the parentKey
.
Also I did not the use of getNodeKey
parameter, so can you please explain these thing with some example.
Actually I am pretty new for React. So please help me to get out of it.
@fritz-c can you please look into it.
Thanks
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:14 (1 by maintainers)
Top Results From Across the Web
How to add the child node using parent key - Syncfusion
You can add the child node in parent node using parent key column in TreeViewAdv control by using Add() method. This can be...
Read more >node.js - Adding parent key to this json output - Stack Overflow
I am using restify module on node.js to build a REST API server. I have this simple API using restify. var api_get_sample =...
Read more >Find the parent of a node in the given binary tree
Given a tree and a node, the task is to find the parent of the given node in the tree. Print -1 if...
Read more >How to get a parent node key in the InitNewNode event
NewNodeParentKey property to get the key value of a new node's parent. This answer was helpful 1.
Read more >how to find parent node key in the child node determination ...
You get the key of your current root instance by following the "to_parent" association. Regards,. Martin. Add a Comment. Help to improve this ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
try this code:
It’s works fine for me.
@everyonesdesign Thanks for taking the time to explain. I do have another question - if you need to get the parent of the node, why don’t you use the
path
? If yourpath = [2,3,1]
, then the parent should betreeData[2].children[3]
?Edit: i guess what i posted above is true, but that info doesn’t necessarily make finding the parent easier. I ended up using a slightly modified version of your function. Thanks for the help!