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
controlling the treemenu both from parent component as well as the +/- against node #109
Comments
|
I'll close this issue for now. Feel free to re-open this issue if necessary 😄 |
Hi @iannbing, I'm wondering if there was a regression here. I took the story that was mentioned above (code on Stackblitz) and with
it worked as described above. When changing to
per your suggestion the tree control doesn't respect the activeKey/openNodes state that is set by the buttons. If I set the initial states then the tree does load with the correct open/highlighted nodes but control after that isn't working. thoughts? EDIT: I also tried a version with the wrapper (Stackblitz link) as I thought maybe that was the issue per the ReadMe, but still not working. |
In summary,
If you want to set the tree shape at any time and still keep the built-in behaviors, I'd suggest using
|
Hi, The closest I was able to get is this. I have to click the buttons twice (maybe timing issue?) and simulate a click on the resetButton but again still not what I was looking for. I'm hoping for an easier way to set the openNodes and activeKey by passing in a value(s) and keeping all other default behavior. To get this behavior now I basically need to rewrite most of this component (I started down that path and it was not trivial). Can I turn this into a feature request for something (API?) that will do this? |
Did you see my PR on this? Thoughts? |
Hi, I was away from work for quite a while. Thanks for your PR. I have some comments. |
Hi - Thanks for this useful component. I was wondering if there is a way to control the tree menu via both the parent component (as demonstrated in the story (https://iannbing.github.io/react-simple-tree-menu/?path=/story/treemenu--control-treemenu-from-its-parent) as well as via the +/- next to each menu item?
Looking at the code it seems if you use openNodes instead of initialOpenNodes it stops you from controlling the tree menu using the +/-. Any particular reason why thats the case or suggestions on how I can get both of them to work?
My particular use case is where i have a list of items and on clicking on each item it changes a view displaying additional details depending on which item is selected. The view is where i have the tree menu component. So the list of items is my parent component and view is child. And based on which item is selected and according the value of a particular field of the item i set the active key on the tree menu and the open nodes. But I also want to be able to change the value to something else and hence it would require me to toggle the +/- to select any other menu from the tree.
The text was updated successfully, but these errors were encountered: