I faced the same issue and attempted some suggested solutions without success due to compatibility issues with my grid version. After delving into the grid's source code, I identified the template used for aggregate rows, duplicated it, and modified it to incorporate a call to a function within my method for parts of the presentation:
Within my gridOptions, I specified the following property
aggregateTemplate: "<div ng-click=\"row.toggleExpand()\" ng-style=\"rowStyle(row)\" class=\"ngAggregate\">" +
" <span class=\"ngAggregateText\"><span class='ngAggregateTextLeading'>{{row.totalChildren()}} {{row.label CUSTOM_FILTERS}} {{entryMaybePlural(row)}}</span><span>Total Weight: {{aggFunc(row)}} lbs {{AggItemsLabel}}</span></span>" +
" <div class=\"{{row.aggClass()}}\"></div>" +
"</div>" +
""
Within the controller scope for the grid, I implemented the functions
$scope.aggFunc = function (row) {
var total = 0;
angular.forEach(row.children, function(cropEntry) {
total+=cropEntry.entity.weight;
});
return total.toString();
};
$scope.entryMaybePlural = function (row) {
if(row.children.length>1)
{
return "entries";
}
else
return "entry";
};
In both instances, the row is passed from the template to the function within the controller scope, where I access the children property of the row (discovered through Chrome debugging tools after previous attempts failed).
PS: The top of my grid includes this compilation note, albeit without indicating a specific version :|
/***********************************************
* ng-grid JavaScript Library
* Authors: https://github.com/angular-ui/ng-grid/blob/master/README.md
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
* Compiled At: 06/03/2013 21:19
***********************************************/