2016-07-07 2 views
0

권한을 표시하기 위해 ui-grid를 사용하고 있습니다. cellTemplate에서 checkbox 및 perfoming updation을 표시하는 중 ... 선택한 체크 박스 및 모든 체크 박스 선택과 유사합니다. 이제 헤더에 체크 박스를 추가하고 클릭 한 다음 체크 박스를 모두 선택하고 모두 선택을 취소하십시오. 선택한 '-'표시가 하나만 나타나면 ... . 이 내가ui-grid angularjs의 헤더에 확인란을 추가하는 방법

angular.forEach($scope.moduleRoles, function (role, key) { 
       $scope.mgridOptions.columnDefs.push({name: role, displayName: role, width: 150,headerCellTemplate: "<span> \ 
     <span ng-class=\"'colt' + col.index\" class=\"ngHeaderText\"> \ 
      {{col.displayName}} \ 
      '<input type=\"checkbox\" ng-model=\"role.checked\" class=\"chckBox\" ng-click=\"checkAll(role.checked);\">' \ 
     </span> \ 
    </span>" , cellTemplate: '<input type="checkbox" ng-model="row.entity.roles[\'' + key + '\'].selected" ng-click="grid.appScope.updateModulePerms(row.entity,\'' + key + '\')">'}); 
      }); 

$ scope.moduleRoles을 시도하고 코드는 서버에서 오는 역할 데이터가 들어 있습니다. 헤더에 체크 박스를 추가 할 수 있습니다. 그러나 checkAll 함수가 작동하지 않아 체크 박스 디자인을 변경할 수 없습니다.

$scope.optionsGrid = { 
    enableSelectAll: true, 
    enableRowHeaderSelection: true 
} 

를 다음 행 선택 이벤트에 대한 콜백 함수 처리기를 추가 : 내가 wrong.Please 도움

답변

0

오전

당신은 사용할 수 있습니다

$scope.gridOptions.onRegisterApi = function (gridApi) { 
       $scope.gridApi = gridApi; 
       gridApi.selection.on.rowSelectionChanged($scope, callbackFunction); 
       gridApi.selection.on.rowSelectionChangedBatch($scope, callbackFunction); 
      } 
} 
관련 문제