我是靠谱客的博主 简单纸鹤,这篇文章主要介绍jQuery easyUI datagrid 增加求和统计行的实现代码,现在分享给大家,希望可以做个参考。

在datagrid的onLoadSuccess事件增加代码处理。

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<style type="text/css"> .subtotal { font-weight: bold; }/*合计单元格样式*/ </style> <script type="text/javascript"> function onLoadSuccess() { //添加“合计”列 $('#table').datagrid('appendRow', { Saler: '<span class="subtotal">合计</span>', TotalOrderCount: '<span class="subtotal">' + compute("TotalOrderCount") + '</span>', TotalOrderMoney: '<span class="subtotal">' + compute("TotalOrderMoney") + '</span>', TotalOrderScore: '<span class="subtotal">' + compute("TotalOrderScore") + '</span>', TotalTrailCount: '<span class="subtotal">' + compute("TotalTrailCount") + '</span>', Rate: '<span class="subtotal">' + ((compute("TotalOrderScore") / compute("TotalTrailCount")) * 100).toFixed(2) + '</span>' }); } //指定列求和 function compute(colName) { var rows = $('#table').datagrid('getRows'); var total = 0; for (var i = 0; i < rows.length; i++) { total += parseFloat(rows[i][colName]); } return total; } </script>

以上这篇jQuery easyUI datagrid 增加求和统计行的实现代码就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。

最后

以上就是简单纸鹤最近收集整理的关于jQuery easyUI datagrid 增加求和统计行的实现代码的全部内容,更多相关jQuery内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(165)

评论列表共有 0 条评论

立即
投稿
返回
顶部