Vue-select: Select Same Option Twice

Created on 6 Sep 2018  路  21Comments  路  Source: sagalbot/vue-select

A user is able to select the duplicate options on multiple selects.

sep-05-2018 21-31-42

  • likely related to the new index feature
  • items in the dropdown list are not being highlighted
  • clicking the same option twice in a row will result in expected behavior
  • arrays of strings are unaffected
bug

Most helpful comment

Great!!!!!! it worked for me, but i hadto install python2.7.8 so 'npm install' and 'npm run build' could finished succesfully and then replace the file as you said and finally work. Thank you a lot for the quickly response. Great WORK!!!! @bribar

All 21 comments

Related #627

hey @sagalbot if you don't have a solution yet I worked up a pretty simple one that reduces the footprint too. Let me know if I can help. Thanks!

I jumped the gun using a ES method and realized you probably want more compatibility, so I adjusted your current method instead.

Here is the fix I came up with ...

isOptionSelected(option) { let selected = false this.valueAsArray.forEach(value => { if (typeof value === 'object') { if(this.optionObjectComparator(value, option)){ selected = true } } else if (value === option || value === option[this.index]) { selected = true } }) return selected }

I wrapped the optionObjectComparator in a if statement because 'selected' variable was getting set to false in the loop when iterating the other items not selected.

if(this.optionObjectComparator(value, option)){ selected = true }

Is there any idea when will this be implemented? Thanks.

I also want to know this. Any news? Thanks

help!!! this happends to me when select multiple with objects

@bribar Why don't you create PR?

@TheCelavi @miguelg1583 @JRadagast

Its already been fixed in this commit

https://github.com/sagalbot/vue-select/commit/8a601c0ac3311adb89bc6e31b8cf215b1343d93c

Do you have the most updated?

@bribar, yes i have the last update, but digging deeper the problem is memory reference between v-model variable prop and options, let's say i have in my options array 2 element of object [{id: 123, desc: 'adsas'}, {id: 1234, desc: 'adsasUII'}], but the model variable i get it fill from api, and it have [{id: 123, desc: 'adsas'}], but in java the first elem of object is distinct from the first of the model, beside attributes are identical, when compare objects in java are distinct but if you go attributes by attributes they are the same. Sorry if my english rusty, regards

ahhh, no no sorry, i havent update

@miguelg1583 Sorry I'm not following... do you have a fiddle or anything of the issue I can reference?

how do i update this version??? i am using npm, i am new on this

npm update vue-select

it does not update the file remains intact

see this on npm
image

@miguelg1583 I guess npm isn't updated.

You could clone the vue-select repository from Github

In that repository:

  • npm install
  • npm run build
  • then copy over the repository files in dist/ to your projects /node_modules/vue-select/dist folder

Great!!!!!! it worked for me, but i hadto install python2.7.8 so 'npm install' and 'npm run build' could finished succesfully and then replace the file as you said and finally work. Thank you a lot for the quickly response. Great WORK!!!! @bribar

Sweet!

Really appreciate the support @bribar! The repo is updated, but I haven't tagged a release yet. I've been charging ahead on 3.0 and haven't come up for air to write the changelog for 2.6.

Originally I was going to get a 3.0 release out, then come back and do a minor release for 2.6. I think 3.0 is a month out, so I'll aim to get 2.6 tagged this weekend.

@bribar
Hi sir,
I follow your instructions but still no luck.
do you have any solution for this?

Thank you

@jasoncimafranca what version are you using? Have you tried npm update? My solution was a temporary hack, now that NPM is updated you should get the most recent.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xuwenhao picture xuwenhao  路  3Comments

rudykaze picture rudykaze  路  3Comments

mattWalters0 picture mattWalters0  路  3Comments

manjunath-coachthem picture manjunath-coachthem  路  3Comments

lau-a picture lau-a  路  3Comments