phphe/he-tree-vue

Unfold to path

ishaiavrahami opened this issue · 7 comments

Hi, currently my tree is collapsed and I'm trying to unfold all in the path of the node.
Use case: when i click on something in the UI editor, I would expect the node in the tree to be selected. The only info i have is the path and the ID.

My current workaround is to the the unfoldAll API and then it will be selected.

I would like the unfoldAll API to get the path and unfold the brand to the path.

Any suggestions?

phphe commented
import {walkTreeData} from 'he-tree-vue'

walkTreeData(node, (childNode) => {
  childNode.$folded=false
})

What am i supposed to do with that function? When i pass the node i clicked on it only iterates on children.

i need to open the tree from the root tree node all the way drilled to the selected node and fold others not on the way

phphe commented
this.$refs.tree.foldAll()
this.$refs.tree.iteratePath(youPath, (node) => {
  node.$folded = false
})

That didnt work, this did

this.$refs.tree.foldAll()
for (const { node, path } of this.$refs.tree.iteratePath(node_path)) {
                node.$folded = false;
}

@phphe one more thing,.. what if i work with node ID. can i find paths with my ID's? While everything is folded.

phphe commented

no