path in removeNode
See original GitHub issueI try remove my Node, how I can get path in my case?
export default class TreeVera extends Component {
constructor(props) {
super(props);
this.updateTreeData = this.updateTreeData.bind(this);
this.removeNode = this.removeNode.bind(this);
this.state = {
treeData: [{
title: (<div>
<input />
<button onClick={this.removeNode}>remove</button>
</div>),
}]
};
}
removeNode(e){
this.setState({
treeData: removeNodeAtPath({
treeData: this.state.treeData,
path: ????,
getNodeKey: ({node: TreeNode, treeIndex: number}) => {
console.log(number);
return number;
},
ignoreCollapsed: false,
})
})
}
updateTreeData(treeData) {
this.setState({ treeData });
}
render() {
return (
<div style={{ height: 600 }}>
<SortableTree
treeData={this.state.treeData}
onChange={this.updateTreeData}
/>
</div>
);
}
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Remove node in react-sortable-tree - Stack Overflow
I solved this problem: export default class Tree extends Component { constructor(props) { super(props); this.updateTreeData = this.
Read more >Remove all nodes which don't lie in any path with sum>= k
Given a number K, you have to remove (prune the tree) all nodes which don't lie in any path with sum>=k. Note: A...
Read more >Remove "node" From Menu Path Using Clean URLs | Drupal.org
I have clean URLs enabled. When attempting to create menu items I am unable to define a path without the term "node". Example:...
Read more >JSON Remove Node
You can specify the node to remove using a JSON Path expression. The JSON Path query language enables you to select nodes in...
Read more >Find all paths in a graph when removing one node of the ...
Wolfram Community forum discussion about Find all paths in a graph when ... Then start over with the original graph and remove node...
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 to use
generateNodeProps
to createdelete
button.I am using the same way but some how getting below exception in browser console
Uncaught (in promise) Error: No node found at the given path.
Let me know if its working for you@fritz-c can you please check am I doing something wrong.
Thanks,
@hungnguyen1412
You can to set newNode : {… currentNode, ItemNode }, removeNodeAtPath({ treeData: treeData, path: myPath, getNodeKey: ({ treeIndex }) => treeIndex, newNode: { …currentNode, ItemNode }, ignoreCollapsed: false }) Working for me