From 5e88f23d7dc72b007fb68c362b006446b4d1a2a8 Mon Sep 17 00:00:00 2001 From: Alexander Mz Tilbe Date: Mon, 11 Mar 2019 15:08:15 -0500 Subject: [PATCH 1/2] Cambiar estilo de la fila Poder cambiar el estilo de una fila aplicando un condicional por "item" --- demo/bootstrap/js/demoApp.js | 3 ++- dist/dataGrid.js | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/demo/bootstrap/js/demoApp.js b/demo/bootstrap/js/demoApp.js index c8d5854..1e37b75 100644 --- a/demo/bootstrap/js/demoApp.js +++ b/demo/bootstrap/js/demoApp.js @@ -3,7 +3,8 @@ angular.module('myApp', ['ui.bootstrap', 'dataGrid', 'pagination']) $scope.gridOptions = { data: [], - urlSync: true + urlSync: true, + customStyle: "item.total.value>1000 ? '' : 'trBack'" }; myAppFactory.getData().then(function (responseData) { diff --git a/dist/dataGrid.js b/dist/dataGrid.js index d7ddb3f..4cdba07 100644 --- a/dist/dataGrid.js +++ b/dist/dataGrid.js @@ -35,6 +35,7 @@ $scope.paginationOptions = angular.copy($scope.defaultsPaginationOptions); $scope.sortOptions = $scope._gridOptions.sort ? angular.copy($scope._gridOptions.sort) : {}; $scope.customFilters = $scope._gridOptions.customFilters ? angular.copy($scope._gridOptions.customFilters) : {}; + $scope.customStyle = $scope._gridOptions.customStyle ? angular.copy($scope._gridOptions.customStyle) : {}; //Implement css class to change row style $scope.urlSync = $scope._gridOptions.urlSync; $scope.$watchCollection('_gridOptions.data', function (newValue) { @@ -301,6 +302,9 @@ } else { element.attr('ng-repeat', "item in filtered | startFrom:(paginationOptions.currentPage-1)*paginationOptions.itemsPerPage | limitTo:paginationOptions.itemsPerPage track by $index"); } + if ($scope.customStyle) { + element.attr('ng-class', $scope.customStyle); + } element.removeAttr('grid-item'); var html = element[0].outerHTML; element.replaceWith($compile(html)($scope)); From 8dc99096c3a127c7ed6b6e5274145d9a1a548def Mon Sep 17 00:00:00 2001 From: Alexander Mz Tilbe Date: Mon, 11 Mar 2019 17:19:00 -0500 Subject: [PATCH 2/2] Update dataGrid.js --- dist/dataGrid.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/dataGrid.js b/dist/dataGrid.js index 4cdba07..3303a24 100644 --- a/dist/dataGrid.js +++ b/dist/dataGrid.js @@ -35,7 +35,7 @@ $scope.paginationOptions = angular.copy($scope.defaultsPaginationOptions); $scope.sortOptions = $scope._gridOptions.sort ? angular.copy($scope._gridOptions.sort) : {}; $scope.customFilters = $scope._gridOptions.customFilters ? angular.copy($scope._gridOptions.customFilters) : {}; - $scope.customStyle = $scope._gridOptions.customStyle ? angular.copy($scope._gridOptions.customStyle) : {}; //Implement css class to change row style + $scope.customStyle = $scope._gridOptions.customStyle ? angular.copy($scope._gridOptions.customStyle) : false; //Implement css class to change row style $scope.urlSync = $scope._gridOptions.urlSync; $scope.$watchCollection('_gridOptions.data', function (newValue) { @@ -448,4 +448,4 @@ }); } } -})(); \ No newline at end of file +})();