麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > JavaScript > 正文

jqGrid表格底部匯總、合計行footerrow處理

2019-11-19 11:00:01
字體:
來源:轉載
供稿:網友

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)案例截圖

2)html代碼

<!DOCTYPE html><html><head> <meta charset="UTF-8" /> <title>jggrid底部匯總行</title>  <link rel="stylesheet"  rel="external nofollow" /> <link rel="stylesheet"  rel="external nofollow" /> <link rel="stylesheet"  rel="external nofollow" /> <link rel="stylesheet"  rel="external nofollow" /> <script src="https://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script> <script src="https://js.cybozu.cn/jqgrid/v5.3.1/js/jquery.jqGrid.min.js"></script> <script src="https://js.cybozu.cn/jqgrid/v5.3.1/js/i18n/grid.locale-en.js"></script></head><body><div class="page-content container"> <div class="page-body"> <!-- page-body --> <div class="panel panel-default" id="panel-orders">  <table id="orders"></table> </div> </div></div><script type="text/javascript"> var data = []; function getBills() { var rowCount = 10; for (var i = 0; i < rowCount; i ++) {  data.push({  sid: i,  goods_no: i + 1,  goods_name: '零件名稱' + rowCount + i,  car_type_name: '車型' + rowCount + i,  package_name: '包裝器具' + rowCount + i,  unit_name: '件',  snp: 0.89,  bill_amount: rowCount + i,  goods_count: rowCount + i,  bill_no: 'BN0000000' + i,  qrcode: '1000000000' + i,  barcode: '1000000000' + i,  }) } $("#orders").jqGrid("clearGridData").jqGrid('setGridParam',{data: data || []}).trigger('reloadGrid'); } $(function() { $("#orders").jqGrid({  colModel: [  {label: "零件號", name: "goods_no", width: 60},  {label: "零件名稱", name: "goods_name", search:false, width: 180},  {label: "車型", name: "car_type_name", width: 70},  {label: "包裝器具", name: "package_name", width: 70},  {label: "單位", name: "unit_name", width: 40},  {label: "訂單號", name: "bill_no", width: 120},  {label: "訂單數量", name: "goods_count", width: 80},  ],  datatype: 'local',  rownumbers: true,  height: 300,  rowNum: 1000,  footerrow: true,  gridComplete: function() {  var rows = $("#orders").jqGrid("getRowData"), total_count = 0;     for(var i = 0, l = rows.length; i<l; i++) {      total_count += (rows[i].goods_count - 0);     }     $("#orders").jqGrid("footerData", "set", {goods_name:"--合計--",goods_count:total_count});     } }); getBills(); });</script></body></html>

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

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 91av在线免费 | 国产刺激高潮av | 亚洲va久久久噜噜噜久牛牛影视 | 欧美性猛交xxxxx按摩国内 | 黄视频网站免费在线观看 | 中文字幕欧美一区二区三区 | 成熟女人特级毛片www免费 | 亚洲一区在线免费视频 | 少妇一级淫片高潮流水电影 | 国产精品久久久久久婷婷天堂 | 国产精品999在线观看 | 中文日韩欧美 | 日日操夜夜操视频 | 久色成人 | 91网页| 大学生一级毛片在线视频 | 毛片一区二区三区四区 | 主播粉嫩国产在线精品 | 精品国产91久久久久久久 | 亚洲人成在线播放网站 | 91久久久久久亚洲精品禁果 | 媚药按摩痉挛w中文字幕 | 欧美一区二区精品夜夜嗨 | 国产精品美女久久久久久不卡 | 色播视频网站 | 精品影视一区二区 | 日韩激情一区 | 欧美一级淫片a免费播放口 91九色蝌蚪国产 | 草免费视频 | 亚洲国产高清自拍 | 成人黄色短视频在线观看 | 国产福利视频在线观看 | 欧美高清另类自拍视频在线看 | 91 在线观看 | 欧美一级免费高清 | 成人免费福利网站 | 福利在线影院 | 成年免费在线视频 | 国产精品资源手机在线播放 | 欧美一级毛片一级毛片 | av影院在线播放 |