Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a Total Row to Footer In ng-grid

I can't seem to find documentation on how I might accomplish this.

I'd like to add totals to the bottom of my grid, in the footer area (i.e. not a standard row that scrolls). Since I am using paging, the totals will need to come from the server--I need the total of all rows, not just displayed rows.

Is this possible?

like image 649
Phil Sandler Avatar asked Oct 17 '13 20:10

Phil Sandler


1 Answers

Yes, you should be able to do this using the footerTemplate. To enable the footer set the showFooter grid option to true. You can replace the footer template by using the grid option footerTemplate.

The footer sites at the bottom of the grid and does not scroll. Since the footer template sits outside the grid, you will have to replace the default template with your own and align the columns.

Inside your custom footer template, you can call into your controller scope, therefore, retrieving any server-side totals values.

Here is a very simple plunker: http://plnkr.co/edit/31flwE?p=preview

Hope this helps.

like image 77
Davin Tryon Avatar answered Nov 19 '22 09:11

Davin Tryon