【发布时间】:2015-09-04 01:58:58
【问题描述】:
上图显示了将数据与敲除数组绑定后的结果。然而,预期的结果并非如此。我想要下面的结果,如图所示
HTML 代码
<table class="table tableMini top10">
<thead>
<tr>
<th>Workflow</th>
<th style="width:190px;">Access</th>
</tr>
</thead>
<tbody data-bind="foreach: Access_label">
<tr>
<td data-bind="text: $data.Application">
<strong/>
</td>
<td>
<input type="checkbox">
</td>
</tr>
<tr>
<td>
<table class="table tableMini top10">
<tbody data-bind="foreach: $data.ListAccessRights">
<tr>
<td data-bind="text: $data.Name">
<span class="l45"/>
</td>
<td>
<input type="checkbox">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
上图显示了来自服务器的响应
敲除js代码
GetRoleList: function () {
var self = this
$.ajax({
type: "GET",
url: '/Employee/GetRoleList',
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
success: function (data) {
self.RoleList(data.Roles);
self.Roles_Type_list(data.RoleType);
self.Campaign_Type_list(data.CampaignType);
self.Access_label(data.AccessRight);
},
error: function (err) {
alert(err.status + " : " + err.statusText);
}
});
}
我想知道如何执行循环,以便获得想要的结果
【问题讨论】:
标签: javascript jquery twitter-bootstrap model-view-controller knockout-2.0