Open sowka1995 opened 1 month ago
Hey there!
Thank you for your kind words! 😊
The functionality that you described can be implemented using the current version itself with a combination of these customizations and props: onCheck
callback, CheckboxComponent
/ CustomNodeRowComponent
, and the ref-exposed function: unSelectNodes
.
Although there is no built-in support to implement single node selection directly, thanks to the high customizability of the TreeView
component, the implementation is totally possible, specifically like this:
CheckboxComponent
/ CustomNodeRowComponent
to create your own custom tree node component that uses a radio button instead of the checkbox.onCheck
callback to determine/store which tree node has been checked by the user.onCheck
callback call the unSelectNodes
ref function to unselect the previously checked node. This way you can ensure only one node is checked at a time.I hope this helps! If you have any more questions or need further assistance, feel free to ask. 🙏
Thanks for the answer!. Unfortunately, the program then falls into an infinite update loop after calling unselectNodes in the onCheck handler. Additionally, is it possible to disable auto selection of all direct children when we click on the parent? eg. when I click on the root then only this one node is selected not all childs
Hi,
well done! Your control looks great, but is it possible to adapt your solution to single node selection? I need something exactly like this, but instead of checkboxes, for example, a radiobutton, where you can select only one node.
Thanks in advance for your answer!