当页面加载时,请填写以下内容:
<select class="form-control"
data-bind="options: UsersList,
optionsText: function(item) {
return item.name()
},
value: selectedUser"></select>
然后选择其中一个用户并
self.loadADGroups = () => {
self.selectedUser().ActiveDirectoryUserGroupList.removeAll();
let getParams = {
distinguishedName: self.selectedUser().ident()
};
$.ajax({
method: 'GET',
url: ActiveDirectoryGroupsListUrl,
data: getParams,
success: (responseData) => {
responseData.forEach((o, i, a) => {
var vm = getActiveDirectoryGroupViewModel(o);
self.selectedUser().ActiveDirectoryUserGroupList.push(vm);
});
},
error: () => {
}
});
}
Html表格:
<div id="ReportActiveDirectoryGroupUser" data-bind="with: selectedUser() ">
<table id="ReportTableActiveDirectoryGroupUser" style="width:100%">
<thead>
<tr>
<th>Nazwa grupy w AD</th>
<th>Opis grupy w AD</th>
</tr>
</thead>
<tbody data-bind="foreach: ActiveDirectoryUserGroupList">
<tr>
<td><span data-bind="text: AdName"></span></td>
<td><span data-bind="text: Addecsription"></span></td>
</tr>
</tbody>
</table>
</div>
该表的行数与从控制器返回的模型的行数相同,但其中没有数据,而模型中有
1条答案
按热度按时间dba5bblo1#
返回模型有
AdName
,AdDescription
-但是在responsedata
中,有adName
,adDescription
.这个工作。