Pre Select UiSelect
See original GitHub issueSorry for all the inquiries but I just don’t understand how this is supposed to be used.
I have 2 UiSelects one is multi the other is not. I want both to be preselected, but the objects that I pass in as selected are not equal to those in the list (they are for good reasons loaded from 2 different places in the app and therefor have different attributes, but text and value are consistent).
<ui-select
name="roles"
v-ref:roles
label="Roles"
:options="roles"
:keys="{text: 'en', value: 'id'}"
@closed=""
validation-rules="required"
multiple>
</ui-select>
<ui-select
name="title"
v-ref:title
label="Title"
:options="titles"
:keys="{text: 'en', value: 'id'}"
@closed=""
validation-rules="required">
</ui-select>
Right now I pass it as value, as this is the only way I could make it work a little, but not satisfying (the $refs part is due to be changed):
this.$refs.title.value = this.user.title;
this.$refs.roles.value = this.user.roles;
I would like that the UiSelect checks for key.value
(here id
) for a match and preselect that and preselects all intersect value
(or id
) between this.$refs.roles
and this.user.roles
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
How can I set the default value for an HTML <select> element?
The pre-selected option will be displayed first in the drop-down list. <select> <option value="volvo">Volvo</ ...
Read more >W3Schools Tryit Editor - Pre-selected Option
<p>You can preselect an option with the selected attribute:</p> <form action="/action_page.php"> <label for="cars">Choose a car:</label>
Read more >How to specify that an option should be pre-selected when the ...
We can pre-select any option by just specifying the selected attribute in its respective option tag.
Read more >How to preselect a value in a dropdown list of items in HTML ...
With HTML, you can easily create a simple drop down list of items to get user input in HTML forms. A select box...
Read more >How to pre-select select statements in Laravel - Laracasts
I have a select statement with a large number of options to select. I am retrieving all of the options from my back-end...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah, the computed is the same as just passing the
user.roles
array.The reason yours doesn’t work is because you have a syntax error on line 6:
Should be
computed: {
instead ofcomputed() {
See if this example fits your use case: http://codepen.io/JosephusPaye/pen/VKYQOW?editors=1000