我正在使用ASP.NET WEB API的jqgrid。如何在jqgrid中創建兩個頁腳行
我想在jqgrid的頁腳中添加兩行。
因此,網絡上的一些搜索帶給我這個鏈接(2010年),說「這是不可能的」,我認爲答案是2010年,可能現在有些事情/一些解決方法可能已經使這成爲可能。
我想在頁腳顯示什麼?
我想顯示兩行
- 總在當前頁面數據預設
- 總計爲存在於所有頁面的數據
我能夠傳遞數據並讀取數據,問題是如何使用這些數據並在jqgrid中創建兩個頁腳行。
有什麼想法?
我正在使用ASP.NET WEB API的jqgrid。如何在jqgrid中創建兩個頁腳行
我想在jqgrid的頁腳中添加兩行。
因此,網絡上的一些搜索帶給我這個鏈接(2010年),說「這是不可能的」,我認爲答案是2010年,可能現在有些事情/一些解決方法可能已經使這成爲可能。
我想在頁腳顯示什麼?
我想顯示兩行
我能夠傳遞數據並讀取數據,問題是如何使用這些數據並在jqgrid中創建兩個頁腳行。
有什麼想法?
我發現這個問題有意思,所以我創建the demo這表明從可能實現的2列的頁腳之一:
主要的想法是,添加第二行中的表,其中標準頁腳已經存在。爲了消除jqGrid代碼其他部分可能出現的問題,我將footrow
自定義行中的類名替換爲myfootrow
。具有相同的CSS設置爲原始tooter有我包括的.ui-jqgrid tr.footrow td
從ui.jqgrid.css
具有相同的定義爲.ui-jqgrid tr.myfootrow td
副本的第二頁腳:
.ui-jqgrid tr.myfootrow td {
font-weight: bold;
overflow: hidden;
white-space:nowrap;
height: 21px;
padding: 0 2px 0 2px;
border-top-width: 1px;
border-top-color: inherit;
border-top-style: solid;
}
完整的代碼,你會發現下面
footerrow: true,
loadComplete: function() {
var $this = $(this),
sum = $this.jqGrid("getCol", "amount", false, "sum"),
$footerRow = $(this.grid.sDiv).find("tr.footrow"),
localData = $this.jqGrid("getGridParam", "data"),
totalRows = localData.length,
totalSum = 0,
$newFooterRow,
i;
$newFooterRow = $(this.grid.sDiv).find("tr.myfootrow");
if ($newFooterRow.length === 0) {
// add second row of the footer if it's not exist
$newFooterRow = $footerRow.clone();
$newFooterRow.removeClass("footrow")
.addClass("myfootrow ui-widget-content");
$newFooterRow.children("td").each(function() {
this.style.width = ""; // remove width from inline CSS
});
$newFooterRow.insertAfter($footerRow);
}
$this.jqGrid("footerData", "set", {invdate: "Total (page):", amount: sum});
// calculate the value for the second footer row
for (i = 0; i < totalRows; i++) {
totalSum += parseInt(localData[i].amount, 10);
}
$newFooterRow.find(">td[aria-describedby=" + this.id + "_invdate]")
.text("Grand Total:");
$newFooterRow.find(">td[aria-describedby=" + this.id + "_amount]")
.text($.fmatter.util.NumberFormat(totalSum, $.jgrid.formatter.number));
}
在代碼中,我在頁腳的invdate
和amount
列中設置了附加信息。
檢查此鏈接:http://stackoverflow.com/questions/7392987/jqgrid-total-amount-row –