Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v-select defaultText is not selectable #57

Closed
mfferreira opened this issue Dec 31, 2016 · 7 comments
Closed

v-select defaultText is not selectable #57

mfferreira opened this issue Dec 31, 2016 · 7 comments
Assignees
Labels
T: enhancement Functionality that enhances existing features

Comments

@mfferreira
Copy link
Contributor

There should be an option for v-select to enable the selection of defaultText.

Either that or an option to default to one of the items in :options.

@johnleider
Copy link
Member

After experimenting with ways to handle this, I'm currently at the conclusion of in order to solve this, I would need to place a slot that you can manually iterate through options for. Here's why:

With v-model, I'm able to notify the parent of changes made to the value property within the child. Let's say I only pass an options array-

options: [{ text: 'Value 1', value: 1},{ text: 'Value 2', value: 2, selected: true}]

and I use the selected property to determine what is selected. How do I notify the parent of the change? Do I keep a shallow copy in the component and only update that if the instance isn't bound by a v-model? I can do that, which would be an alternative to the slot, but is there a compelling use-case?

As far as to enable the selection of the defaultText, it's technically not an option that is bound for selection, it is only there to represent an empty state.

@mfferreira
Copy link
Contributor Author

The use case would be for editing data. When selecting an object, you'd want to fill the form with object (selected) properties.

@mfferreira
Copy link
Contributor Author

Here's a bit more argument for this.

On my specific use case, I have objects that reference other objects. For example, a User as a property roleId referencing a Role object. But this property is not required, which means that roleId can be left undefined/null.
From a UX perspective, on the select input I have two options:

  • either I set a label to it and have the first select option for None, to be able to not have a Role selected for this User. Problem: I'm not able to select "None" if I have another option selected.
    image
    image

  • or I don't set a label and have the first select option as the "label". Problem: Looks weird, specially cause all the other inputs have labels set.
    image
    image

Hope that shines some light about the (UX) issue.

@johnleider
Copy link
Member

This sounds reasonable, I'll prep this for v0.8.4

@johnleider johnleider self-assigned this Jan 1, 2017
@johnleider johnleider added the T: enhancement Functionality that enhances existing features label Jan 1, 2017
@johnleider
Copy link
Member

Added ability to enable default option. 7ffb6e0

@bombicode
Copy link

Hello, please tell me why there is no property defaultDisabled in the latest version 0.17? Thanks in advance

KaelWD pushed a commit that referenced this issue Oct 28, 2018
Update README.md with yarn link vuetify
@lock
Copy link

lock bot commented Apr 15, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please direct any non-bug questions to our Discord

@lock lock bot locked as resolved and limited conversation to collaborators Apr 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T: enhancement Functionality that enhances existing features
Projects
None yet
Development

No branches or pull requests

3 participants