使用ng-table angular的列总和 [英] sum of columns using ng-table angular

查看:276
本文介绍了使用ng-table angular的列总和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用angular / ng-table以表格形式绘制数值数据。
我无法弄清楚如何在表格的末尾添加一行,显示每列的所有值的总和。
我可以在服务器端计算数据并将其显示在UI中。
但是有没有办法在ng-table / ng-grid中实现这个目的?
任何帮助将不胜感激。

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 compute 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.

谢谢

推荐答案

你的意思是这样的?

<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>

这篇关于使用ng-table angular的列总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆