emberjs如何禁用Ember.Select? [英] emberjs how to disable Ember.Select?

查看:80
本文介绍了emberjs如何禁用Ember.Select?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类似的问题

Emberjs - 禁用并启用TextField

所以对于文本字段它是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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆