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

Disabling the Select Component #190

Closed
easyt opened this issue Jun 3, 2016 · 5 comments
Closed

Disabling the Select Component #190

easyt opened this issue Jun 3, 2016 · 5 comments
Assignees

Comments

@easyt
Copy link

easyt commented Jun 3, 2016

There doesn't seem to be a way to disable the select component.

  1. Am I missing something?
  2. Will you be adding this feature?
  3. Is there a way to work around this?

I was hoping to have something similar to the following: md-button="disabled.bind: disableButton"

Thanks.

@Thanood
Copy link
Collaborator

Thanood commented Jun 3, 2016

Good point.. 👍

Materialize itself supports disabling its select but changing that "dynamically" is not straightforward possible. By that I mean switching from disabled to enabled and back.

I've tried to do it and the following works:

  • find .select-wrapper
  • remove the disabled class from its .caret child
  • remove the disabled attribute from its .select-dropdown child
  • remove the disabled attribute from the wrapped select
  • call (basically) this: $('.select-dropdown').dropdown({'hover': false, 'closeOnClick': false}); (depending on options)

Disabling works in the opposite direction.

I'm sure we can do this in the bridge.
Question is if we should because others may have other workarounds and we shouldn't conflict with those. But I guess if it's a property in the md-select attribute it shouldn't conflict..

@Thanood Thanood self-assigned this Jun 3, 2016
@easyt
Copy link
Author

easyt commented Jun 3, 2016

Thanks. I hope it gets built in :)

@Thanood
Copy link
Collaborator

Thanood commented Jun 3, 2016

Demo: https://gist.run/?id=9215cb0cefe0e1701d9c095f828f0676

I'll add it soon.. Monday the latest. 😄

@easyt
Copy link
Author

easyt commented Jun 3, 2016

That's great! Thank you.

@Thanood Thanood closed this as completed in 3bfc9c8 Jun 6, 2016
@Thanood
Copy link
Collaborator

Thanood commented Jun 6, 2016

Implemented just now. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants