ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

footerCellClass function gets called only once

Open miah-al opened this issue 11 years ago • 2 comments

I need a way to show footer sum in red for negative numbers and black with positive numbers. I am trying to achieve this using footerCellClass. The problem is that it gets called only once even before the data is loaded.

miah-al avatar Jun 19 '15 16:06 miah-al

I tried this with a plunker and it looks like the function is getting called post-filter, but one digest too late: http://plnkr.co/edit/M4r1RE029TnRD48uSvc3?p=preview

If you filter the column it will update the color, but using the LAST aggregation value...

c0bra avatar Jun 19 '15 17:06 c0bra

Hi @c0bra ,

I made a small change to fix this locally. It seems to work.

In uiGridFooterCell directive,

  1. Comment the following lines //if ($scope.col.footerCellClass) { // updateClass(); //}
  2. Listen to rowsRendered to call updateClass

$scope.grid.api.core.on.rowsRendered( $scope, $scope.col.updateAggregationValue ); $scope.grid.api.core.on.rowsRendered( $scope, updateClass ); $scope.$watch( $scope.col, updateClass );

$scope.$on( '$destroy', dataChangeDereg );

miah-al avatar Jul 05 '15 19:07 miah-al