问题
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!
回答1:
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.
来源:https://stackoverflow.com/questions/11457206/emberjs-how-to-disable-ember-select