Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 213
Madasu K Avatar asked Feb 01 '26 23:02

Madasu K


1 Answers

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.

like image 80
Kathir Avatar answered Feb 03 '26 13:02

Kathir



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!