我正在使用包含選擇視圖修改以提供選項組的Ember的最新版本。除了我似乎無法設置默認值之外,它工作正常。如何在分組模式下使用Ember.Select設置默認選擇?
我有一個的jsfiddle這裏:http://jsfiddle.net/csprocket777/Ja77Z/
鑑於上面的小提琴,我將如何設置默認值?
我插入的jsfiddle這裏的代碼:
HTML
<script type="text/x-handlebars">
{{view Ember.Select
contentBinding=filterValues
optionLabelPath="content.label"
optionValuePath="content.id"
optionGroupPath="group"
selectionBinding=selectedFilterOption
}}
</script>
的Javascript
App = Ember.Application.create();
App.ApplicationController = Ember.ArrayController.extend({
selectedFilterOption: Ember.Object.create({
label: "File Type",
id: "urltype",
group: "By Attributes"
}),
filterValues:function(){
var ret = [
Ember.Object.create({
label: "Unfiltered",
id: "id",
group: "By Attributes"
}),
Ember.Object.create({
label: "Alphabetical",
id: "label",
group: "By Attributes"
}),
Ember.Object.create({
label: "File Type",
id: "urltype",
group: "By Attributes"
}),
Ember.Object.create({
label: "Title",
id: "title",
group: "By Value"
}),
Ember.Object.create({
label: "Order",
id: "order",
group: "By Value"
})
];
return ret;
}.property()
});
我想這可能是一個問題 – selvagsz