我正在做的一切正确,但由于一些奇怪的原因,我无法嵌套列表显示
<div>
<span>Account</span>
<hr/>
<table>
<thead>
<tr>
<th>System Name</th>
<th>Manual link</th>
<th>Contact No</th>
</tr>
</thead>
<tbody data-bind="foreach: mapping.employee">
<tr>
<td data-bind="text :SystemName"></td>
<td data-bind="text : ManualLink"></td>
<td data-bind="text : ContactNo "></td>
</tr>
<tr>
<table>
<thead>
<tr>
<th>AccountName</th>
<th>AccountType</th>
<th>Username</th>
<th>Password</th>
</tr>
</thead>
<tbody data-bind="foreach: UserAccount">
<tr>
<td data-bind="text: AccountName"></td>
<td data-bind="text: AccountType"></td>
<td data-bind="text: Username"></td>
<td data-bind="text: UserAccount"></td>
</tr>
</tbody>
</table>
</tr>
</tbody>
</table>
<hr/>
</div>
var data ={ "employee": [{
"SiteId": 9,
"SystemId": 1,
"SystemName": "Glocus",
"ManualLink": "http://www.Glocus.com/Guide",
"ContactNo": "301-489-8989",
"UserAccount": [{
"AccountId": 1,
"AccountName": "Sisij",
"AccountType": "Customer System",
"Username": "Tybeke",
"Password": "*****"
}, {
"AccountId": 2,
"AccountName": "gabid",
"AccountType": "System System",
"Username": "Tybeke",
"Password": "*****"
}]
}, {
"SiteId": "1",
"SystemId": 2,
"SystemName": "TheSecondWorld",
"ManualLink": "http://www.TheSecondWorld.com/Guideplan",
"ContactNo": "301-489-8989",
"UserAccount": [{
"AccountId": 1,
"AccountName": "Uniqex",
"AccountType": "Customer System",
"Username": "TUniqux",
"Password": "*****"
}, {
"AccountId": 5,
"AccountName": "Celind",
"AccountType": "System System",
"Username": "GCElinds",
"Password": "*****"`enter code here`
}]
}]};
model = function()
{
self = this;
self.mapping = ko.mapping.fromJS(data);
};
ko.applyBindings(模型);
http://jsfiddle.net/32765/2/
我已经有一段时间了。缺什么?任何帮助将不胜感激。我已经包含了上面提琴手的链接。