Given a tree
how to initialize it in such way that the nodes are expanded at will?
I already tried to get a reference with @ViewChildren(Tree) tree
but is resulting in undefined
references when trying to access his children
Given a tree
how to initialize it in such way that the nodes are expanded at will?
I already tried to get a reference with @ViewChildren(Tree) tree
but is resulting in undefined
references when trying to access his children
You can handle this with a function that put all the expanded attributes to true.
This is a hack that basically simulates clicks along the tree. I add this solution but I really hope someone could find something better.
Given a component with a
tree
we can get a reference to thetreenodes
and then "click" them as necessary:In case you need to initialize deeper nodes in the tree you will need to nest
setTimeout
functions.For initialize your tree component expanded you only need set in you json format the property expanded as true.
Sample: