riophae / vue-treeselect

A multi-select component with nested options support for Vue.js
https://vue-treeselect.js.org/
MIT License
2.91k stars 509 forks source link

individual selection on parent nodes #484

Open naiduyanda opened 2 years ago

naiduyanda commented 2 years ago

Hi,

I have a parent node, some of which nodes are not to be selected on parent selection. but I should be able to select individually. Is there any way for this?

TitanFighter commented 2 years ago

If I understand here is the demo of what you need: https://vue-treeselect.js.org/#more-features

naiduyanda commented 2 years ago

Hi, Thanks for the reply

actually, this is not what I need, suppose A is group and having a child (1,2,3,4),

one of the children 3 should be selected individually, on clicking A this 3 shouldn't be selected.

TitanFighter commented 2 years ago

one of the children 3 should be selected individually, on clicking A this 3 shouldn't be selected.

Sorry, I do not understand it. Do you mean that on clicking A just 3 must be selected or just 1,2,4? or do you mean that you want to select just 3, then on clicking A you want to select 1,2,4 + deselect 3?

naiduyanda commented 2 years ago

on clicking on A 1,2,4 should be selected, and 3 shouldn't be selected

TitanFighter commented 2 years ago

The simplest way I can come up right now is to let Treeselect select all children (1,2,3,4), this fires "select" event which you can listen and then you can deselect 3.

Another option (probably), do not use "v-model", use :value="yourValues" + events, so you can handle yourValues as you need yourself.