shentao / vue-multiselect

Universal select/multiselect/tagging component for Vue.js
https://vue-multiselect.js.org/
MIT License
6.72k stars 989 forks source link

Group options label instead of all the selected children #1396

Open GMolini opened 3 years ago

GMolini commented 3 years ago

Is it possible to display the group label, instead of the selected children? for example, in the docs sample https://vue-multiselect.js.org/#sub-option-groups If I click on 'Javascript' I would like to have 'Javascript' displayed on the select box, and not 'Vue.js' and 'Adonis' Thanks!

adrianmiu commented 3 years ago

Yes. Use the #selection template

<template #selection>
        {{ selectionText }} <!-- this is a computed property -->
</template>
dima-bzz commented 3 years ago

@adrianmiu Could show an example. Thanks.

akki-jat commented 2 years ago

@GMolini We can do it with current version but is very complex.

Please check https://codesandbox.io/s/vue-multiselect-show-group-insteadof-option-iqs3mk

We will try to to make it smooth in future release.