|
1327 | 1327 | * @param {array} parents the parents that we would want to aggregate onto
|
1328 | 1328 | */
|
1329 | 1329 | aggregate: function( grid, row, parents ){
|
1330 |
| - if ( parents.length === 0 ){ |
1331 |
| - return; |
| 1330 | + if ( parents.length === 0 && row.treeNode && row.treeNode.aggregations ){ |
| 1331 | + row.treeNode.aggregations.forEach(function(aggregation){ |
| 1332 | + // Calculate aggregations for footer even if there are no grouped rows |
| 1333 | + if ( typeof(aggregation.col.treeFooterAggregation) !== 'undefined' ) { |
| 1334 | + var fieldValue = grid.getCellValue(row, aggregation.col); |
| 1335 | + var numValue = Number(fieldValue); |
| 1336 | + aggregation.col.treeAggregationFn(aggregation.col.treeFooterAggregation, fieldValue, numValue, row); |
| 1337 | + } |
| 1338 | + }); |
1332 | 1339 | }
|
1333 | 1340 |
|
1334 | 1341 | parents.forEach( function( parent, index ){
|
|
1338 | 1345 | var numValue = Number(fieldValue);
|
1339 | 1346 | aggregation.col.treeAggregationFn(aggregation, fieldValue, numValue, row);
|
1340 | 1347 |
|
1341 |
| - if ( index === 0 && typeof aggregation.col.treeFooterAggregation !== 'undefined' ){ |
| 1348 | + if ( index === 0 && typeof(aggregation.col.treeFooterAggregation) !== 'undefined' ){ |
1342 | 1349 | aggregation.col.treeAggregationFn(aggregation.col.treeFooterAggregation, fieldValue, numValue, row);
|
1343 | 1350 | }
|
1344 | 1351 | });
|
|
1507 | 1514 | */
|
1508 | 1515 | treeFooterAggregationType: function( rows, column ) {
|
1509 | 1516 | service.finaliseAggregation(undefined, column.treeFooterAggregation);
|
| 1517 | + if ( typeof(column.treeFooterAggregation.value) === 'undefined' || column.treeFooterAggregation.rendered === null ){ |
| 1518 | + // The was apparently no aggregation performed (perhaps this is a grouped column |
| 1519 | + return ''; |
| 1520 | + } |
1510 | 1521 | return column.treeFooterAggregation.rendered;
|
1511 | 1522 | }
|
1512 | 1523 | };
|
|
0 commit comments