frontend-collective / frontend-collective/react-sortable-tree
How to add child node in parent.
- Dominant language
- JavaScript
- Stars
- 5k
- Forks
- 914
- PR merge metrics
- No merged PRs in 30d
Description
Hi, anybody please tell me how to add children data in parent node,
handleClickOnItem(rowInfo) {
const NEW_NODE = [ { title: 'A }, { title: 'B }, { title: 'C }, { title: 'D }];
const newTree = addNodeUnderParent({
treeData: this.state.treeData,
newNode: NEW_NODE,
expandParent: true,
parentKey: rowInfo ? rowInfo.treeIndex : undefined,
getNodeKey: ({ treeIndex }) => treeIndex,
});
this.setState({ treeData: newTree.treeData })
}
i am trying to add children array inside the parent, but its not working,
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.