JQGrid:将数据加载到页脚行 [英] JQGrid: Loading data into the footer row

查看:134
本文介绍了JQGrid:将数据加载到页脚行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有将数据加载到页脚中的示例?我找不到任何东西,或者我在工作中受阻.

Are there any examples for loading data into the footer? I can't find any or I'm being blocked at work.

预先感谢...

推荐答案

查看演示 http: //trirand.com/blog/jqgrid/jqgrid.html

,然后在左侧树中选择" 3.5版的新功能",然后选择"页脚摘要".

and choose on the left tree "New in Version 3.5" and then "Summary Footer Row".

在示例中,jqGrid的一组footerrow : true, userDataOnFooter : true选项.然后服务器将userdata块添加到发送回jqGrid的数据中.您可以在 http://www.trirand中阅读有关userdata的信息. com/jqgridwiki/doku.php?id = wiki:retrieving_data .如果userdata方块帽属性与jqGrid的列名相对应,则数据将在页脚行中看到.

In the example one set footerrow : true, userDataOnFooter : true option of the jqGrid. Then server add userdata block to the data sent back to jqGrid. You can read about userdata in http://www.trirand.com/jqgridwiki/doku.php?id=wiki:retrieving_data. If userdata block hat properties corresponds to the column names of the jqGrid, the data will be seen in the footer row.

如果需要更多信息,则应编写在jqGrid中使用的数据类型(JSON,XML,xmlstring,jsonstring,本地等)以及使用哪种服务器(PHP,ASP.NET MVC,WCF)结束等等).

If you need more information you should write which kind of data you use in jqGrid (JSON, XML, xmlstring, jsonstring, local and so on) and what kind of server do you use (PHP, ASP.NET MVC, WCF end so on).

更新:如果您使用标准json映射服务器中的数据(jqGrid没有jsonReader选项),

UPDATED: If you use standard json mapping your data (no jsonReader option of jqGrid) from server look like

{ 
  total: "xxx", 
  page: "yyy", 
  records: "zzz",
  rows : [
    {id:"1", cell:["cell11", "cell12", "cell13"]},
    {id:"2", cell:["cell21", "cell22", "cell23"]},
      ...
  ]
}

因此,数据没有colModel中的列名称.例如,如果您在colModel内有一列{name:'price',...},并想在jqGid的最后一行显示总价,则应在jqGrid选项内定义footerrow: true, userDataOnFooter: true,并且服务器应产生类似

So the data has no name of columns from colModel. If you have, for example, one column {name:'price', ...} inside of colModel and want to show total price in the last row of jqGid you should define footerrow: true, userDataOnFooter: true inside of the jqGrid options and your server should produce data like

{ 
  total: "xxx", 
  page: "yyy", 
  records: "zzz",
  rows : [
    {id:"1", cell:["cell11", "cell12", "cell13"]},
    {id:"2", cell:["cell21", "cell22", "cell23"]},
      ...
  ],
  userdata: {price:1240.00} 
}

如果您使用另一个jsonReader,则所有状态不变.您唯一可以定义的就是将用户数据"名称更改为其他名称,但是值必须是具有字段名称的对象,就像您在colModel中定义的那样.仅此字段的值将在jqGrid的最后一行显示为胖.

If you use another jsonReader all stat unchanged. The only which you can define is to change "userdata" name to another name, but the value must be an object with the field name like you defined in colModel. Only values of this fields will be shown fat on the last row of jqGrid.

这篇关于JQGrid:将数据加载到页脚行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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