vue-multiselect icon indicating copy to clipboard operation
vue-multiselect copied to clipboard

after select return value from array of object.

Open amchconsult opened this issue 4 years ago • 6 comments

it always return an array. How do I return just a value from the array of object. [ {id:1, title: "text1"}, {id:2, title: "text2"} ]

label is title, but I want it to only return the id value.

thank you

amchconsult avatar Apr 07 '20 14:04 amchconsult

+1

bymaximus avatar Apr 08 '20 02:04 bymaximus

+1

ravisankarchinnam avatar Aug 12 '20 09:08 ravisankarchinnam

as it seems multiselect doesn't support that. There is another long issue about it. I've just changed to vue-select last week because of that. Since a lot of parameters are called the same you can almost use it as drop in replacement.

yennor avatar Aug 14 '20 16:08 yennor

is there some progress?

ViacheslavZyrianov avatar Aug 21 '20 07:08 ViacheslavZyrianov

I have been using: https://github.com/sagalbot/vue-select hope it helps

amchconsult avatar Aug 21 '20 12:08 amchconsult

You can use @input="(e)=>{yourMethod(e)}" Then you can create the method, ie:

yourMethod(e) {
    if(this.suppliers.includes(e[0].id)){
        this.suppliers=_.without(this.suppliers,e[0].id)
    }else{
        this.suppliers.push(e[0].id)
    }
},

(in my example I'm populating an array called 'suppliers' with the ID of the returned value) - worked in my tests

gbrits avatar May 31 '21 18:05 gbrits

Duplicate of https://github.com/shentao/vue-multiselect/issues/1270

akki-jat avatar Nov 11 '22 16:11 akki-jat