我能够成功地为我的选择列表设置选项,但未设置所选选项。
谁能看到我做错了什么?
http://jsfiddle.net/devlife/YmshY/2/
html:
<select data-bind="options: FundTypeOptions, optionsText: 'Text', optionsValue: 'Value', value:
Javascript:
$root.SelectedFundType"></select>
$(function(){
var options = {
"ImportType":0,
"ImportTypeList":{
"":"",
"Funds":"Fund Level Investments",
"Valuations":"Valuations"
},
"FundTypeOptions":[
{"Value":"","Text":""},
{"Value":"Initial","Text":"Initial"},
{"Value":"FollowOn","Text":"Follow-on"}
],
"SelectedImportType":"Funds",
SelectedFundType: "FollowOn"
};
var viewModel = {
FundTypeOptions: ko.observableArray(options.FundTypeOptions)
};
ko.applyBindings(viewModel);
});