EasyUi DataGrid 绑定数据格式问题
如果显示汇总记录则需设置页脚属性:
首先设置showFooter:true,
然后后台计算出合计数据,一起传过来,类似如下:
{"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":19.80,"listprice":60.40,"productid":"Average:"},
{"unitcost":198.00,"listprice":604.00,"productid":"Total:"}
]}
注意:“footer”中的数据是一个与主表数据格式一样的表格,字段与之对应,我的处理方式是新建一个Datatable,然后传到页面中。
DataTable footer = new DataTable();
footer.Columns.Add("unitcost", typeof(string));
DataRow drfooter = footer.NewRow();
drfooter["unitcost"] = "合计:" + sum;
footer.Rows.Add(drfooter);
需要汇总某一列,在新表中只加那一列即可。
EasyUi DataGrid 绑定数据格式问题的更多相关文章
- easyui datagrid 绑定json对象属性的属性
今天用easyui 的datagrid绑定数据时,后台提供的数据是实体类类型的,其中有一个实体类A的属性b是另一个实体类B类型的,而前台需要显示b的属性c,这下就悲剧了,前台没法直接绑定了,后来脑筋一 ...
- easyui datagrid 绑定从后台得到的复杂的特殊数据结构
由于项目需要,从后台得到的数据统一为了类似{state:xxx,data:xxx,message:xxx}类型 但是easyui datagrid却只认{total:xxx,rows:xxx}...所 ...
- [html][easyui]DataGrid 绑定
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- Easyui datagrid 绑定本地Json数据
var jsonstr = '{"total":1,"rows":[{"id":"M000005","name ...
- Easyui datagrid绑定数据,新增,修改,删除方法(一)
@{ ViewBag.Title = "UsersList"; } <script type="text/javascript"> $(functi ...
- Easyui datagrid绑定数据,新增,修改,删除写法
@{ ViewBag.Title = "xw_xsfl"; } <script type="text/javascript"> var editIn ...
- EasyUI DataGrid定制默认属性名称
EasyUI DataGrid绑定服务器返回Json数据的解决方案 1. 服务器返回的数据对象格式,及初始化返回值 public class RequestResult { private int c ...
- EasyUI datagrid 明细表格中编辑框 事件绑定 及灵活计算 可根据此思路 扩展其他
原创 : EasyUI datagrid 明细表格中编辑框 事件绑定 及灵活计算 可根据此思路 扩展其他 转载,请注明出处哦!谢谢! 原创 : EasyUI datagrid 明细表格中编辑框 事件绑 ...
- easyUI之datagrid绑定后端返回数据的两种方式
先来看一下某一位大佬留下的easyUI的API对datagrid绑定数据的两种方式的介绍. 虽然精简,但是,很具有“师傅领进门,修行靠个人”的精神,先发自内心的赞一个. 但是,很多人和小编一样,第一次 ...
随机推荐
- Cloudera Manager(CentOS)安装介绍
相信通过这篇文章大家都对Cloudera Manager及CDH安装有一个整体的认识 目 录 1 准备工 作.................................... ...
- tomcat启动报错:Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At least one of these environment variable
linux 下 启动tomcat 报: Neither the JAVA_HOME nor the JRE_HOME environment variable is definedAt least o ...
- pip install robotframework-sshlibrary提示: Microsoft Visual C++ 9.0 is required
win7下 pip install robotframework-sshlibrar时提示: error: Microsoft Visual C++ 9.0 is required (Unable t ...
- underscorejs-some学习
2.11 some 2.11.1 语法: _.some(list, predicate, [context]) 2.11.2 说明: 对list集合的每个成员根据predicate进行真值检测,如果一 ...
- [UML]UML中几种类间关系
UML中类间关系主要有六种,分别是继承.实现.依赖.关联.聚合.组合 1.继承 继承是指A类继承B类,继承它private除外的所有属性和方法,这种关系是最常见的关系,在java中使用extends表 ...
- Win7 64位 php-5.5.13+Apache 2.4.9+mysql-5.6.19 配置
一 :准备阶段 1:php php-5.5.13下载链接:http://windows.php.net/downloads/releases/php-5.5.13-Win32-VC11-x64.zip ...
- 一、UITableView的属性
一.UITableView的属性 NSIndexPath类型是用来获取用户选择的indexPath,在别的函数里面,若需要知道用户选择了哪个cell,用上它可以省事很多.不必再去建全局变量sectio ...
- Solr In Action 笔记(4) 之 SolrCloud分布式索引基础
Solr In Action 笔记(4) 之 SolrCloud Index 基础 SolrCloud Index流程研究了两天,还是没有完全搞懂,先简单记下基础的知识,过几天再写个深入点的.先补充上 ...
- 作了点有意义 的事,加入CLOUDSTACK官方文档的中文翻译工作
https://www.transifex.com/ 昨天到今天,作了个部署构架方面的翻译.
- new Thread的弊端(转)
new Thread的弊端如下: a. 每次new Thread新建对象性能差.b. 线程缺乏统一管理,可能无限制新建线程,相互之间竞争,及可能占用过多系统资源导致死机或oom.c. 缺乏更多功能,如 ...