The view Ember.Select does not do this out of the box. You will need to add a custom attribute binding for disabled and the corresponding computed property to tell Ember how to find it.
A simple approach is to add a disabled attribute to the content / data element used to render the selection.
App.ApplicationController = Ember.Controller.extend({ choices: function() { return [ Ember.Object.create({firstName: "Lorem", id: 1}), Ember.Object.create({firstName: "Ipsum", id: 2, disabled: true}), Ember.Object.create({firstName: "Dolor", id: 3}), Ember.Object.create({firstName: "Sit", id: 4}), Ember.Object.create({firstName: "Amet", id: 5}) ]; }.property() });
and reopen or expand the Ember.SelectOption by adding the disabled attribute and the computed property.
Ember.SelectOption.reopen({ attributeBindings: ['value', 'selected', 'disabled'], disabled: function() { var content = this.get('content'); return content.disabled || false; }.property('content'), });
This is where jsbin works. Note that the ipsum parameter ipsum disabled.
Darshan sawardekar
source share