温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

jqGrid表格底部汇总、合计行footerrow处理

发布时间:2020-06-15 02:44:51 来源:网络 阅读:1297 作者:nineteens 栏目:开发技术

  jqGrid提供了表格底部汇总、合计行功能,我们先看下user-guide关于jqGrid合计行都有哪些说明?然后再看个DEMO,看看jqGrid表格底部汇总、合计行到底如何实现。

  1、user-guide关于jqGrid合计行的说明

  1)表格配置:footerrow, boolean, 默认false

  If set to true this will place a footer table with one row below the gird records and above the pager. The number of columns equal those specified in colModel

  表格是否显示底部合计行。

  2)表格配置:userDataOnFooter,boolean,默认false

  When set to true we directly place the user data array userData in the footer if the footerrow parameter is set to true. The rules are as follows: If the userData array contains a name which matches any name defined in colModel, then the value is placed in that column. If there are no such values nothing is placed. Note that if this option is used we use the current formatter options (if available) for that column. See footerData method.

  如果设为true,则userData可以用来填充汇总行。

  3)汇总行赋值:footerData([string action], [object data], [boolean format])

  This method gets or sets data on the grid footer row. When set data in the footer row, the data is formatted according to the formatter (if defined) in coModel. The method can be used if footerrow option is set to true.

  parameters

  string action - can be ‘get’ or ‘set’. The default is get. ‘get’ returns an object of type name:value, where the name is a name from colModel. This will return data from the footer. The other two options have no effect in this case. ‘set’ takes a data object and places the values in the footer The value is formatted according to the definition of the formatter in colModel - see next parameter. The object should be in name:value pair, where the name is the name from colModel

  object data - data to be set in the footer in name:value pair, where the name should correspond to the name of colModel in order to be set in the appropriate cell.

  boolean format - default is true. This instruct the method to use the formatter (if set in colModel) when new values are set. A value of false will disable the using of formatter

  2、一个DEMO,如何利用gridComplete事件进行表格数据汇总并赋值给合计行

  1)案例截图

  

jqGrid表格底部汇总、合计行footerrow处理


  2)html代码无锡好的×××医院 http://www.zzch220.com/

  3)代码说明:

  表格构建时,设置:footerrow: true

  gridComplete(jqGridGridComplete)事件处理,进行数据汇总并赋值给合计行

  gridComplete fires after all the data is loaded into the grid and all other processes are complete. Also the event fires independent from the datatype parameter and after sorting paging and etc. Does not fire if datatype is a defined as function.

  4)获取汇总行数据

  var row = $("#orders").jqGrid(“footerData”, “get”);


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI