jqGrid table summarizes the bottom line total processing footerrow

  jqGrid provides a summary of the bottom of the table, the total line functions, we look at user-guide on what are jqGrid total row explanation? Then look at a DEMO, look at the bottom jqGrid summary form, in the end how to achieve total row.

  1, a user-guide on the total line jqGrid

  1) Form Configuration: footerrow, boolean, default 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

  Total table is displayed at the bottom line.

  2) Form Configuration: userDataOnFooter, boolean, default 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.

  If true, then userData can be used to fill the summary row.

  3) a summary row assignment: 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, a DEMO, how gridComplete event data summary table and assigned to the total row

  1) Case Screenshot

  

Here Insert Picture Description


  2) html codes Wuxi good ××× hospital http://www.zzch120.com/

  3) Code Description:

  When constructing a table setting: footerrow: true

  gridComplete (jqGridGridComplete) event processing, the data are summarized and assigned to the total row

  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) obtain data summary rows

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


Guess you like

Origin blog.51cto.com/14335413/2407151