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

  • 时间:
  • 浏览:53

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、1个DEMO,若何操纵gridComplete事务停止表格数据汇总并赋值给开计止

1)案例截图

2)html代码




 
 jggrid底部汇总止
 
 
 
 
 
 
 
 


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”);

以上便是本文的全数内容,期望对各人的进修有所帮忙,也期望各人多多撑持剧本之家。