Skip to content
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

[Feature Request] v-select event that returns selected/deselected items when using the multiple prop #14151

Open
jonabox opened this issue Sep 12, 2021 · 1 comment
Labels
C: VSelect VSelect T: feature A new feature

Comments

@jonabox
Copy link

jonabox commented Sep 12, 2021

Problem to solve

Currently I have to store a copy of my v-model to be able to determine what items I added or removed to or from the array selection, like so:

<v-select
multiple
v-model="selection"
:items="options"
@input="(selection) => findDifference(selection, previousSelection)"
></v-select>

I then have to find the difference of selection and previousSelection to figure out which item was just added or removed. Finally I have to add some more logic to figure whether the item was added or removed. It would be usefull for me if the @input event also told me which item I just added or removed into/out of my v-model array. Currently, it only gives me the full selection array.

Proposed solution

two additional parameters (added, removed) with @input that store the added or removed element like so:

<v-select
multiple
v-model="selection"
:items="options"
@input="(selection, added, removed) => validate(selection, added, removed)"
></v-select>
@glen-84 glen-84 added C: VSelect VSelect T: feature A new feature labels Sep 19, 2021
@Vercadium
Copy link

Just hit this today 😄 Would be great to have this supported in V3; ideally the change event would supply the item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VSelect VSelect T: feature A new feature
Projects
None yet
Development

No branches or pull requests

3 participants