나는 이것이 당신이 원하는 것, Mero에 가까울 것이라고 믿습니다.
자바 스크립트/AngularJS와 컨트롤러 :
app.controller('MainCtrl', ['$scope', '$http', function($scope, $http) {
var colorRowTemplate =
//same as normal template, but extra ng-class for firstSelection: 'first-selection':row.entity.firstSelection
"<div ng-repeat=\"(colRenderIndex, col) in colContainer.renderedColumns track by col.uid\" ui-grid-one-bind-id-grid=\"rowRenderIndex + '-' + col.uid + '-cell'\" class=\"ui-grid-cell\" ng-class=\"{'first-selection':row.entity.firstSelection, 'ui-grid-row-header-cell': col.isRowHeader }\" role=\"{{col.isRowHeader ? 'rowheader' : 'gridcell'}}\" ui-grid-cell></div>";
$scope.gridOnRegisterApi = function(gridApi) {
gridApi.selection.on.rowSelectionChanged($scope, function(row) {
row.entity.firstSelection = false;
if (row.isSelected) row.entity.firstSelection = (gridApi.selection.getSelectedCount() == 1);
});
};
$scope.gridOptions = {
enableSelectAll: true,
enableRowSelection: true,
enableRowHeaderSelection: false,
enableFullRowSelection: true,
rowTemplate: colorRowTemplate,
showGridFooter: true,
onRegisterApi: $scope.gridOnRegisterApi
}
$http.get('data.json')
.then(function(response) {
$scope.gridOptions.data = response.data;
});
}]);
는 다음 작업 Plunker, http://plnkr.co/edit/radkmw2T7wRCuiJ06Cyj?p=preview입니다.