Expand tree when selecting node

This commit is contained in:
Magnus Åhall 2023-07-22 09:31:26 +02:00
parent 1a49884a3a
commit b35bb30631
2 changed files with 12 additions and 1 deletions

1
TODO
View File

@ -1,5 +1,4 @@
* Fix dynamic tree updates when adding a new node
* Expand tree to show selected node when going throw goToNode()
* Create new admin user when no user exists
* File deletion
- per file

View File

@ -253,6 +253,7 @@ class Tree extends Component {
this.selectedTreeNode = this.treeNodeComponents[node.ID].current
this.selectedTreeNode.selected.value = true
this.selectedTreeNode.expanded.value = true
this.expandToTrunk(node.ID)
}//}}}
crumbsUpdateNodes(node) {//{{{
this.props.app.startNode.Crumbs.forEach(crumb=>{
@ -272,6 +273,17 @@ class Tree extends Component {
if(node !== undefined)
this.setSelected(node)
}//}}}
expandToTrunk(nodeID) {//{{{
let node = this.treeNodes[nodeID]
if(node === undefined)
return
node = this.treeNodes[node.ParentID]
while(node !== undefined) {
this.treeNodeComponents[node.ID].current.expanded.value = true
node = this.treeNodes[node.ParentID]
}
}//}}}
}
class TreeNode extends Component {