午夜勾魂曲-午夜福利自怕-午夜福利在线观看6080-午夜福利院电影-国产精品毛片AV久久97-国产精品麻豆高潮刺激A片

jqGrid 表格底部匯總、合計(jì)行footerrow處理

2019-10-12    seo達(dá)人

jqGrid提供了表格底部匯總、合計(jì)行功能,我們先看下user-guide關(guān)于jqGrid合計(jì)行都有哪些說(shuō)明?然后再看個(gè)DEMO,看看jqGrid表格底部匯總、合計(jì)行到底如何實(shí)現(xiàn)。



1、user-guide關(guān)于jqGrid合計(jì)行的說(shuō)明

1)表格配置:footerrow, boolean, 默認(rèn)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

表格是否顯示底部合計(jì)行。



2)表格配置:userDataOnFooter,boolean,默認(rèn)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.

如果設(shè)為true,則userData可以用來(lái)填充匯總行。



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、一個(gè)DEMO,如何利用gridComplete事件進(jìn)行表格數(shù)據(jù)匯總并賦值給合計(jì)行

1)案例截圖



2)html代碼



<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8" />

<title>jggrid底部匯總行</title>



<link rel="stylesheet" href="https://cdn.bootcss.com/twitter-bootstrap/3.3.7/css/bootstrap.min.css" />

<link rel="stylesheet" href="https://cdn.bootcss.com/font-awesome/4.5.0/css/font-awesome.min.css" />

<link rel="stylesheet" href="https://cdn.bootcss.com/jqueryui/1.11.0/jquery-ui.min.css" />

<link rel="stylesheet" href="https://js.cybozu.cn/jqgrid/v5.3.1/css/ui.jqgrid.css" />

<script src=";

<script src="
;

<script src="
;

</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: "零件號(hào)", 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: "訂單號(hào)", name: "bill_no", width: 120},

{label: "訂單數(shù)量", 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:"--合計(jì)--",goods_count:total_count});

        }

});

getBills();

});

</script>

</body>

</html>



3)代碼說(shuō)明:



表格構(gòu)建時(shí),設(shè)置:footerrow: true

gridComplete(jqGridGridComplete)事件處理,進(jìn)行數(shù)據(jù)匯總并賦值給合計(jì)行

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)獲取匯總行數(shù)據(jù)

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

藍(lán)藍(lán)設(shè)計(jì)m.gerard.com.cn )是一家專注而深入的界面設(shè)計(jì)公司,為期望卓越的國(guó)內(nèi)外企業(yè)提供卓越的UI界面設(shè)計(jì)、BS界面設(shè)計(jì)  cs界面設(shè)計(jì)  ipad界面設(shè)計(jì)  包裝設(shè)計(jì)  圖標(biāo)定制  用戶體驗(yàn) 、交互設(shè)計(jì)、 網(wǎng)站建設(shè) 平面設(shè)計(jì)服務(wù)

日歷

鏈接

個(gè)人資料

存檔

主站蜘蛛池模板: 手机看片一区二区 | 国产一卡2卡3卡4卡孕妇网站 | 亚洲精品成人在线 | 欧美xx69 | 3344永久在线观看视频免费 | 99久久国产综合精品 | 旧里番6080在线观看 | 国偷自产AV一区二区三区健身房 | 亚洲精品久久久久久偷窥 | 男人桶女人j的视频在线观看 | 欧美白妞大战非洲大炮 | 精品国产90后在线观看 | 免费果冻传媒2021在线观看 | 香蕉久久夜色精品国产小说 | 超碰97视频在线观看 | 草莓西瓜樱桃香蕉直播视频 | 不戴套挺进人妻怀孕 | 日本福利片午夜免费观着 | 美女的避毛 | 我的家庭女教师 | 国产精一品亚洲二区在线播放 | 和尚轮流澡到高潮H | 日韩人妻无码精品-专区 | 印度最猛性ⅹxxxxx | 3344永久在线观看视频免费 | 视频成人永久免费下载 | 黄色天堂在线 | 久久精品黄AA片一区二区三区 | 久久婷婷色香五月综合激情 | 热久久视久久精品2015 | 国产精品99AV在线观看 | 国产亚洲日韩另类在线播放 | 理论片午午伦夜理片影院 | 国产麻豆精品久久一二三 | 男女牲交全过程免费播放 | 亚洲国产精品99久久久久久 | 一个人免费完整在线观看影院 | 亚洲国产综合久久精品 | 免费夜里18款禁用软粉色 | 久久日本精品国产精品 | 亚洲国产免费观看视频 |