我想使用Ember.select创建一个下拉列表,我的问题是当它第一次呈现,我想设置一个默认值。一旦我改变了选择,它将不会检查默认值,直到刷新页面。设置选择默认值与Ember.Select
下面是代码:
ET.selectedAppYearController = Ember.Object.create({
appYear: null,
isChanged: function() {
if (this.appYear != null) {
LoadETByAppYearETTypeID(this.appYear.text, ET.selectedEmailTypesController.emailType.email_template_type_id);
}
} .observes('appYear'),
setDefault: function() {
if (this.appYear.text == 2012) {
this.set('selection',2012);
}
} .observes('appYear')
});
的观点:
{{view Ember.Select
contentBinding = "ET.appYearController.content"
selectionBinding="ET.selectedAppYearController.isDefault"
optionLabelPath="content.text"
optionValuePath="content.value"
}}
我想我需要设置selectionBinding的东西......但什么样的价值,我应该结合? 1.下拉列表值是JSON类型。
我改变selectionBinding =“2012”下拉列表中产生,但选择为空。它没有绑定到值...或者我应该使用这个selectionBinding的其他值? – Princa