Madasu K
Madasu K

Reputation: 1863

Angularjs Ui grid grouping formatting is needed

I am using Angularjs ui grid grouping functionality. Please see the image, When displaying group sum, by default it is getting displayed as 'total :' but I want to change it to 'Total' (capital 'T') and also I want to restrict aggregated totals to 2 decimal numbers. Where I need to change the settings?

The following is my colDef for the Ui Grid:

angular.forEach(columns, function(value, key) {
        columnDefs.push({
            name: key,
            displayName: value,
            enableCellEdit: false,
            aggregationType: uiGridConstants.aggregationTypes.sum,
            width: '8%'
        })
    });

uiGridGrouping

Upvotes: 3

Views: 1913

Answers (1)

Kathir
Kathir

Reputation: 6196

If you want to customize the column footer , you need to provide a footerCellTemplate to the column.

The footerTemplate can be configured to only show two decimals

footerCellTemplate: '<div class="ui-grid-cell-contents">\'Total\' (capital \'T\') {{col.getAggregationValue() | number:2 }}</div>'

http://plnkr.co/edit/u75EC8gxdIBxHzthaH15?p=preview shows an example where you can change the label and decimals.

Upvotes: 5

Related Questions