I am using angular/ng-table to plot numerical data in tabular form. I am not able to figure out how to bring in a row at the end of my table which shows sum of all the values of each column. I can pute the data on the server side and present it in the UI. But is there a way to achieve this in ng-table/ng-grid? Any help will be appreciated.
thanks
I am using angular/ng-table to plot numerical data in tabular form. I am not able to figure out how to bring in a row at the end of my table which shows sum of all the values of each column. I can pute the data on the server side and present it in the UI. But is there a way to achieve this in ng-table/ng-grid? Any help will be appreciated.
thanks
Share Improve this question asked Oct 3, 2013 at 16:55 poshakposhak 1051 gold badge3 silver badges11 bronze badges 2- What of summing in the controller using the data retrieved from the server? – kubuntu Commented Oct 3, 2013 at 17:02
- you can access your data array. You just need to do it in JS in the controller and show it in the template. – maxisam Commented Oct 3, 2013 at 19:22
1 Answer
Reset to default 4You mean something like this?
<table ng:init="stuff={items:[{description:'gadget', cost:99},{description:'thing', cost:101} ]}">
<tr>
<th>Description</th>
<th>Cost</th>
</tr>
<tr ng:repeat="item in stuff.items">
<td>{{item.description}}</td>
<td>{{item.cost}}</td>
</tr>
<tr>
<td></td>
<td>{{stuff.items.$sum('cost')}}</td>
</tr>