hummingbird-treeview icon indicating copy to clipboard operation
hummingbird-treeview copied to clipboard

single checkbox select, parent-only select options

Open selaromdotnet opened this issue 5 years ago • 2 comments

This control is pretty great, thanks for sharing! However, it appears there isn't any way to provide the option to only select one node.

I tried to work around this using the nodeChecked event by unchecking all but the selected node. This ALMOST works, however it does not allow the selction of a parent node specifically if it also has children, because when you deselect those, it in turn deselects the parent!

I looked over the code to see if this is something I could easily modify but it looks like you're traversing on each action and I had trouble unwrapping it to make this optional.

I'd like to fork this project and give it a try, but do you have any notes that I could use to achieve this change? any insight you have would be very helpful and appreciated!

selaromdotnet avatar Dec 20 '19 02:12 selaromdotnet

Thanks for using the treeview. The single-checkbox-select can be achieved like you did. However I use the getChecked method for that. I will inlcude a new section in the README, which deals with these add on functionalities, which can be achieved with some extra logic. I have to think about the parent-only-select, seems tricky because of the whole tri-state logic ... I'll come back to you soon.

hummingbird-dev avatar Dec 21 '19 13:12 hummingbird-dev

I've now included this new section: https://github.com/hummingbird-dev/hummingbird-treeview#add-on-options-and-functionality The "select-single-node" is straight forward. The "select-single-group" is a bit tricky. I'm not sure, if this is exactly what you were looking for. The idea is to allow one or more nodes to be checked within a group, but not across groups. I've also not tested it fully, so it's in an experimental state.

hummingbird-dev avatar Dec 23 '19 14:12 hummingbird-dev