Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ember.Select allowing options to be disabled. Usage `{{view Ember.Select ... optionDisabledPath="content.disabled"}}`
var get = Ember.get, getPath = Ember.getPath, set = Ember.set, fmt = Ember.String.fmt;
Ember.Select.reopen({
optionDisabledPath: null
});
Ember.SelectOption.reopen({
attributeBindings: ['disabled'],
init: function() {
this.disabledPathDidChange();
this._super();
},
disabledPathDidChange: Ember.observer(function() {
var valuePath = get(this, 'parentView.optionDisabledPath');
if (!valuePath) { return; }
Ember.defineProperty(this, 'disabled', Ember.computed(function() {
return get(this, valuePath);
}).property(valuePath));
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.