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

Ignores/Overrides enabled state when used with KnockoutJs #80

Closed
peteski22 opened this issue Mar 4, 2013 · 1 comment
Closed

Ignores/Overrides enabled state when used with KnockoutJs #80

peteski22 opened this issue Mar 4, 2013 · 1 comment

Comments

@peteski22
Copy link

When used with KO JS, and the data-bind="enable: someTrueFalseValue" the drop down seems to be regularly enabled, even when it should be disabled.

By removing class="selectpicker" from the HTML everything works as expected! :( But I don't get the lovely bootstrap select styling.

Sad times.

e.g.
'''
select id="things"
data-bind="options: myThings, optionsText: 'name', optionsValue: 'id', value: 'myId' enable: false"
class="selectpicker"
/select
'''
Doesn't disable.. removing the selectpicker class, it's always disabled.

I know that the README suggests adding a 'disabled' attribute, when it should be disabled, but I can't see how this can be done with Knockout, I've tried attr { 'disabled: whetherMyThingShouldBeDisabled } .. but to no avail as it seems bootstrap select wants disabled or nothing, not disabled = true/false.

@caseyjhol
Copy link
Member

After disabling the select, you'll need to call the refresh() method:

$('.your-select').selectpicker('refresh');

See it in action at the bottom of the documentation (http://silviomoreto.github.com/bootstrap-select/)

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

No branches or pull requests

2 participants