设置选中:$scope.gridApi.selection.selectRow(rowEntity);
取消选中:$scope.gridApi.selection.unSelectRow(rowEntity);
获取选中行: $scope.gridApi.selection.getSelectedRows();
选中所有行:$scope.gridApi.selection.selectAllRows();
取消选中的所有行:$scope.gridApi.selection.clearSelectedRows();
头文件里需要加上$timeout
(function () {
angular.module(‘app‘).controller(‘app.hrm.views.salary.salaryDifferentMonthPaymentStatement.selectApplyEmployees‘, [
‘$scope‘, ‘$uibModalInstance‘, ‘$timeout‘, ‘abp.services.app.salary‘,
function ($scope, $uibModalInstance,$timeout, salaryService) {
}
加载的方法:
function init(url) {
salaryService.getAll({ id: id}).then(function (result) {
vm.gridOptions.totalItems = result.data.totalCount;
vm.gridOptions.data = result.data.items;
angular.forEach(vm.gridOptions.data, function (v, k) {
if (v.isChecked) {
$timeout(function () {
$scope.gridApi.selection.selectRow(v);
}, 1000);
}
else {
$timeout(function () {
$scope.gridApi.selection.unSelectRow(v);
}, 1000);
}
});
}).finally(function () {
vm.loading = false;
});
}