emberjs如何禁用Ember.Select? [英] emberjs how to disable Ember.Select?
问题描述
我有一个类似的问题
所以对于文本字段它是disabledBinding。
so for text field it's disabledBinding.
Ember.Select(下拉栏)怎么样?
i尝试禁用绑定但不起作用。
what about Ember.Select (drop down field)? i tried disabledBinding but it's not working.
谢谢!
推荐答案
它不工作,因为禁用
未在 attributeBindings
中定义,请参阅代码。
It's not working because disabled
is not defined in attributeBindings
, see code.
解决方案是将 Ember.Select
并将禁用
扩展到连接的属性* attributeBindings
,请参见 http://jsfiddle.net/pangratz666/wTXfH/ :
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属性意味着在子类中覆盖此属性不会覆盖这些值,而是从超类中扩展现有的。
*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.
这篇关于emberjs如何禁用Ember.Select?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!