emberjs how to disable Ember.Select?

橙三吉。 提交于 2019-12-24 03:02:52

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!