Ben soru ilginç buldum, bu yüzden iki satır Altbilginin olası uygulamasından birini gösterir the demo oluşturuldu:
ana fikir tablosundaki ikinci satır eklemek için nerede standart altbilgi zaten mevcut. JqGrid kodunun diğer bölümleriyle ilgili olası sorunları ortadan kaldırmak için, özel satırdaki footrow
sınıf adını myfootrow
olarak değiştirdim. Orijinal tooter ben .ui-jqgrid tr.myfootrow td
için aynı tanımlarla ui.jqgrid.css
den .ui-jqgrid tr.footrow td
kopyasını dahil olduğu gibi ikinci altbilgi için aynı CSS ayarlarını sağlamak için:
.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;
}
tam kod aşağıda bulacaksınız
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));
}
Kodda, invdate
sütunlarında ve altbilginin amount
sütunlarında ek bilgi ayarladım.
bu bağlantıyı kontrol edin: http://stackoverflow.com/questions/7392987/jqgrid-total-amount-row –