manni
manni

Reputation: 717

emberjs how to disable Ember.Select?

i have a similar question to this question

Emberjs - Disable and Enable TextField

so for text field it's disabledBinding.

what about Ember.Select (drop down field)? i tried disabledBinding but it's not working.

thanks!

Upvotes: 2

Views: 2418

Answers (1)

pangratz
pangratz

Reputation: 16163

It's not working because disabled is not defined in attributeBindings, see code.

A solution is to extend the Ember.Select and add disabled to the concatenated property* attributeBindings, see http://jsfiddle.net/pangratz666/wTXfH/:

Handlebars:

<script type="text/x-handlebars" >
    {{view App.Select disabled="true"}}
</script>​

JavaScript:

App.Select = Ember.Select.extend({
    attributeBindings: ['disabled']
});​

*concatenated property means, that overwriting the this property in a subclass does not overwrite the values, but extends the existing ones from the super class.

Upvotes: 6

Related Questions