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

Allow to disable options with selectable function #921

Merged
merged 4 commits into from Oct 25, 2019

Conversation

doits
Copy link
Contributor

@doits doits commented Jul 31, 2019

Implemented as per #309 (comment)

ToDo:

  • Write spec
  • Have it tested by some people

To test this in your project, you can use my custom branch which incoperates this PR and #914 and has built packages.

Disclaimer: Not for production use, only provided for testing purposes. Might be bugged and eat your data.

In your package.json:

"dependencies": {
    "vue-select": "https://github.com/doits/vue-select.git#fix_initial_label_on_ajax_options_built"
}

Closes #104

@coveralls
Copy link

coveralls commented Jul 31, 2019

Coverage Status

Coverage increased (+0.1%) to 96.569% when pulling 2a54205 on doits:disabled into 8ef15a1 on sagalbot:master.

@tobyzerner
Copy link
Contributor

Works well, thanks for your work! A few issues:

  • Unselectable options can still be navigated to with the arrow keys
  • Unselectable options can still be selected by pressing Enter
  • Unselectable options still appear in filtered results

Copy link
Owner

@sagalbot sagalbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think once doits#1 is merged this one is good to go as well. Thanks so much for the great work!!

@doits
Copy link
Contributor Author

doits commented Aug 30, 2019

Thanks for the PR @tobyzerner and fixing those remaining issues in doits#1 - I'll respond here about the business logic so we have everything in one place about it.

I agree with everything but I'm not sure if disabled options should be removed when filtering looking from a business logic stand point. Because actually it might be good to show the user the the disabled option so the user knows there is that option but it is simply not selectable. Maybe because it is temporary disabled or because of some precondition. Otherwise he might think this option does not exist at all.

Of course this depends on what you use disabled options for. Maybe you have something in mind where showing disabled options when filtering makes no sense. Can you maybe give an example use case?

@tobyzerner
Copy link
Contributor

True, that's a very good point. My use case for disabled options is actually to simulate optgroups which is why I don't want them to appear in filtering. So it's probably not a good idea to include that logic by default – I've removed it and rebased my PR. For my particular use-case, I realised I can use the filter/filterBy props to prevent them from showing up!

Fix some selectable functionality
@doits
Copy link
Contributor Author

doits commented Sep 2, 2019

I think once doits#1 is merged this one is good to go as well. Thanks so much for the great work!!

Alright, I merged it, should be ready to go now.

@doits
Copy link
Contributor Author

doits commented Sep 15, 2019

@sagalbot feel free to merge and release this too, if everything is well here :-)

@sagalbot sagalbot added this to the v3.3 milestone Oct 25, 2019
@sagalbot sagalbot merged commit aea81a6 into sagalbot:master Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disabled non selectable results
4 participants