-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not able to maintain "isOpen" status. #70
Comments
Nevermind, I found that I should use
To keep the tree updated Sorry for the trouble. |
@ojhawkins when you use
please double check your state, for example, if some of the children is checked, and some unchecked, the parent should be half check (0.5) |
Ok I worked out what I was doing wrong, I had |
The question is simple. I am trying to set a dictionary with existing "isOpen" keys, so that I can control which nodes are open/closed.
This is the basic example where I set a dict with "isOpen" keys to false, however, whenever I refresh it the tree renders all nodes expanded.
This comes from a more complex setup, where I receive a JSON from an api and set the new directoryTree using useState. The problem is that the FolderTree does not preserve the open/close status from the previous render, so now I am reading the previous status and manually setting the "isOpen" attributes to maintain that state. However, it still does not work. It renders the whole tree open. Minimal example:
My question is:
How can I preserve the open/closed state of the nodes when updating the tree state?
The text was updated successfully, but these errors were encountered: