使用 jqgrid 上的 footerdata 获取总和 [英] getting the sum using footerdata on jqgrid

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

问题描述

我有一个列名 Total.
而且我也在使用页脚
jqgrid 的值.

I have a column name Total.
And I'm also using the footer
value of the jqgrid.

例如这是列

总计
100
-98
-76
98
76

Total
100
-98
-76
98
76

我怎样才能得到行的总和
使用页脚数据.

how can I get the sum of the row
using the footer data.

这是我的代码.
注意:如果我使用 'sum' 它会给我 'NaN'
价值.

here is my code.
note: if i use 'sum' it gives me 'NaN'
value.

var parseTotal= grid.jqGrid('getCol', 'Total', false, 'sum');
grid.jqGrid('footerData', 'set', { Total: parseTotal});

推荐答案

你应该发布更完整的代码来重现问题.我尝试了一些选项:输入数据为字符串,数据为整数,使用 formatter: "integer",不使用格式化程序等等.

You should post more full code which reproduce the problem. I tried some options: the input data as string, the data as integers, using formatter: "integer", using no formatters and so on.

我没有发现没有列定义的输入数据会产生所描述的结果.查看演示

I found no input data of no column definition which produce the described results. Look at the demo

哪个有效,并与您的非工作演示进行比较.我希望你能在你的代码中找到错误.

which works and compare with your non working demo. I hope you will find the error in your code.

这篇关于使用 jqgrid 上的 footerdata 获取总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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