Hello my friend , To I select a data , I need to do it -
data () {
return {
value: [
{ name: 'Vue.js', language: 'JavaScript' }
],
options: [
{ name: 'Vue.js', language: 'JavaScript' },
{ name: 'Adonis', language: 'JavaScript' },
{ name: 'Rails', language: 'Ruby' },
{ name: 'Sinatra', language: 'Ruby' },
{ name: 'Laravel', language: 'PHP' },
{ name: 'Phoenix', language: 'Elixir' }
]
}
}
So this will be selected - { name: 'Vue.js', language: 'JavaScript' } , If I want to send this value to PHP , I need sed all this data - { name: 'Vue.js', language: 'JavaScript' } .
could I reference by ID instead ? just doing like this - value: 2 ? like this example -
data () {
return {
value: [2 ],
options: [
{ id:1', language: 'JavaScript' },
{ id: 2, language: 'JavaScript' },
{ id:3, language: 'Ruby' },
{ id:4, language: 'Ruby' },
{ id: 5, language: 'PHP' },
{ id: 6, language: 'Elixir' }
]
}
}
And send just the value ID , this one - value: [2 ] ? could I do it ? thanks
Not yet possible – you have to provide an object with at least the fields that are required to compare with other options (track-by prop) and the label prop.
This is due to being able to modify the options list dynamically, without breaking the currently selected options.
This would be super helpful, I have to do all sorts of transformations on my value to get it to send an object rather than the plugin just matching where object.value = value rather than object = object exactly.
Most helpful comment
This would be super helpful, I have to do all sorts of transformations on my value to get it to send an object rather than the plugin just matching where object.value = value rather than object = object exactly.