-
Is there a function which I can use to expand and collapse all the tree items? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 7 replies
-
@lukasbach do we have a function or we have to create a custom component to handle this? |
Beta Was this translation helpful? Give feedback.
-
Hi @madhums and @iamravisingh, there currently is no predefined logic for that, but you should be able to do that on your own with a imperative ref on the environment. |
Beta Was this translation helpful? Give feedback.
-
@lukasbach I am halfway through achieving this. However, on a single click the action is not happening as we have to pass a single tree to expand and collapse, is there any way we can pass the entire expanded/collapse tree to achieve this? I have attached a video on the below logic. It would be great if you guide me to achieve this cc: @dlech
|
Beta Was this translation helpful? Give feedback.
-
One option is to implement a But one obstacle for this is, you loose overriding |
Beta Was this translation helpful? Give feedback.
-
I looked into this and wanted to do a demo for how it can be implemented, but found out that just adding it as feature of the library was easier 😅 You can use the methods |
Beta Was this translation helpful? Give feedback.
I looked into this and wanted to do a demo for how it can be implemented, but found out that just adding it as feature of the library was easier 😅 You can use the methods
expandAll()
andcollapseAll()
on a tree ref starting from react-complex-tree 1.1.10. You can see a demo here: https://rct.lukasbach.com/storybook/?path=/story/core-react-refs--expand-or-collapse-all