David-Desmaisons / Vue.D3.tree

Vue component to display tree based on D3.js layout.
https://david-desmaisons.github.io/Vue.D3.tree/tree
MIT License
874 stars 136 forks source link

CollapseAll #64

Open junzai97 opened 4 years ago

junzai97 commented 4 years ago

How can I set the tree to be rendered with all the nodes are collapse?

RoshanAtDure commented 4 years ago

Even I'm looking for same. Please let me know if you have found anything.

Thanks

guog commented 4 years ago

template

<tree
  :data="data"
  ref="tree"
>
</tree>

js

this.$refs.tree.collapseAll(this.$refs.tree.internaldata.root)
ghost commented 3 years ago

@guog 's solution works. Thanks!

For the longest time, i was passing the json into the function instead of this.$refs.tree.internaldata.root