博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
easyUI的汇总列,在前端生成
阅读量:5955 次
发布时间:2019-06-19

本文共 1970 字,大约阅读时间需要 6 分钟。

1、easyUI初始化,启用汇总列,showFooter:true

2、后台json有默认的footer的值

{"total":28,"rows":[    {"productid":"FI-SW-01","unitcost":10.00,"status":"P","listprice":36.50,"attr1":"Large","itemid":"EST-1"},    {"productid":"K9-DL-01","unitcost":12.00,"status":"P","listprice":18.50,"attr1":"Spotted Adult Female","itemid":"EST-10"},    {"productid":"RP-SN-01","unitcost":12.00,"status":"P","listprice":28.50,"attr1":"Venomless","itemid":"EST-11"},    {"productid":"RP-SN-01","unitcost":12.00,"status":"P","listprice":26.50,"attr1":"Rattleless","itemid":"EST-12"},    {"productid":"RP-LI-02","unitcost":12.00,"status":"P","listprice":35.50,"attr1":"Green Adult","itemid":"EST-13"},    {"productid":"FL-DSH-01","unitcost":12.00,"status":"P","listprice":158.50,"attr1":"Tailless","itemid":"EST-14"},    {"productid":"FL-DSH-01","unitcost":12.00,"status":"P","listprice":83.50,"attr1":"With tail","itemid":"EST-15"},    {"productid":"FL-DLH-02","unitcost":12.00,"status":"P","listprice":63.50,"attr1":"Adult Female","itemid":"EST-16"},    {"productid":"FL-DLH-02","unitcost":12.00,"status":"P","listprice":89.50,"attr1":"Adult Male","itemid":"EST-17"},    {"productid":"AV-CB-01","unitcost":92.00,"status":"P","listprice":63.50,"attr1":"Adult Male","itemid":"EST-18"}],"footer":[{"unitcost":合计,"listprice":0}]}

3、前台获取footer的值,然后修改,再刷新

onLoadSuccess: function (data) {
//表单加载完后再加载此方法 sumline(data); }
//汇总列        function sumline(data) {            // var rows = $('#dg').datagrid('getRows')//获取当前的数据行            var ptotal = 0//            for (var i = 0; i < data.rows.length; i++) {                ptotal += parseInt(data.rows[i].listprice);            }            //新增一行显示统计信息            //$('#list').datagrid('appendRow', { strLearningDutyName: '合计:', trainingNum: ptotal, strTrainingTimes: utotal });            var rows = $('#list').datagrid('getFooterRows');            rows[0]["listprice"] = ptotal;            $('#list').datagrid('reloadFooter');        }

 

转载地址:http://gvexx.baihongyu.com/

你可能感兴趣的文章
谈Win32汇编
查看>>
sqlserver_identity
查看>>
其他的AdapterView——Spinner
查看>>
我的友情链接
查看>>
iOS UIWebView打电话
查看>>
PYB Nano 开发板的完整设计文档
查看>>
Eloquent JavaScript 阅读笔记一
查看>>
客户端浏览器Chrome过早断开连接导致Nginx报400错误的解决办法
查看>>
iOS开发进阶教程【第一季小试牛刀】
查看>>
[MVC4]初识.NET MVC4
查看>>
微软公有云魅力之Traffic Manager
查看>>
IP子网划分
查看>>
Kubernetes Secret
查看>>
我的友情链接
查看>>
技术分享连接汇总
查看>>
MongoDB 的分片技术
查看>>
创业团队如何在低成本的情况下保护网站安全
查看>>
JVM学习笔记(二)------Java代码编译和执行的整个过程
查看>>
解除Xcode中Miss File的警告
查看>>
离线抓取域登录缓存hash(mscash)
查看>>