[Feature Request] Allow Treeview nodes to be selected independently of children
Problem to solve
Sometimes it is desirable to have a parent node selected when there are only some or none of the child nodes selected.
In my case, I am applying categories to an object, and the children are subcategories.
Using music genres as an example:
- [x] Dance Music
- [x] Chillstep
- [ ] Deep House
- [ ] Dubstep
- [ ] Electroswing
- [x] Hardcore
- [ ] Breakcore
- [ ] Hardstyle
- [ ] Country Music
- [ ] Folk
I want to mark something as Hardcore, but not a subgenre. In the bound model for the treeview, I want to see Dance music and Hardcore selected.
In the case of an album, I'd also like to be able to specify that there are chillstep songs on there too, being able to select multiple child nodes.
The functionality that I'd like is basically the reverse of the current functionality - Selecting a node marks its parents a selected, and ignores the children.
Proposed solution
Have a prop on the treeview called reverse, inverse, select-parents or something to that effect. Setting this to true changes the selection methodology - select the node and its parents, rather than a node and its children.
+1 would love to see this feature too. Looks similar to this issue: https://github.com/vuetifyjs/vuetify/issues/6759
Hey, looks like this has been requested from three users (me included). Any chance to see this feature in the next releases?
Same problem here. It would be nice to retrieve just a parent object or attach a @click event to a full parent node.
Apparently there's not much interest around this feature...if I happen to have some free time, I can try to implement it and open a PR, there's someone else interested? It doesn't look like a complex task, anyway if there's anybody that wants to help, it would make things faster.
Hi @funder7 ! Just wondering ... did you find some free time to implement this feature?
Hi @danielchodusov , unfortunately I was really busy in the last months, so I wasn't able to implement it.. BTW I've appended two buttons on the side of each father element, to select or deselect all it's children in a single operation. It's a momentary workaround, but it does the job.
If you're interested, I can share the code. Cheers
I'm in the same boat. I'm writing a File-Browser example/tutorial with Electron and I need the get the activated/clicked (parent) node, so I can list the files an the right side of this folder. Maybe an additional option how the selection event (input) would also be fire if the user selects/clicks on a parent node.
@funder7 I would love to see the work-around.
Hi @bromix, here's the workaround, it's a simple solution, not the best, but does the job for the moment :)
Check out the gist
Note: I had to remove some code, it should work as expected though. There is also some example data (items), I wrote this code some time ago, probably that is default structure expected by treeview to show nested items. Some comments & logging remained in place, maybe it can help you to understand how it works!
Happy coding :)
thanks @funder7. This will me help to work around it. Have a nice weekend :)