Jquery jqgrid的三英尺行工作不正常
我需要在jqrid中创建一个三英尺的行,这个想法是在网格的末尾显示3个总计行。为了实现这一点,我休耕这篇文章,这是真正有用的从奥列格 问题是,我在他的代码中做了一些更改,以显示3个总计行,并且在第一次加载数据时工作正常,但如果单击下一页或任何其他操作,它将显示3个总计行,但其中的一个行会重复,因此我将失去第二个总计 这是我的代码:Jquery jqgrid的三英尺行工作不正常,jquery,html,css,jqgrid,salesforce,Jquery,Html,Css,Jqgrid,Salesforce,我需要在jqrid中创建一个三英尺的行,这个想法是在网格的末尾显示3个总计行。为了实现这一点,我休耕这篇文章,这是真正有用的从奥列格 问题是,我在他的代码中做了一些更改,以显示3个总计行,并且在第一次加载数据时工作正常,但如果单击下一页或任何其他操作,它将显示3个总计行,但其中的一个行会重复,因此我将失去第二个总计 这是我的代码: loadComplete: function () {//for showing default edit
loadComplete: function () {//for showing default edit
var $this = $(this), ids = $this.jqGrid('getDataIDs'), i, l = ids.length;
//In order to have three totals
var $this = $(this),
$footerRow = $(this.grid.sDiv).find("tr.footrow"),
$secondFooterRow,$thirdFooterRow;
var f = '$'+{!optyObj.Otter_FFA_Total_Before_GST__c};
var m = '$'+{!optyObj.Otter_FFA_Grand_Total_GST__c};
var l = '$'+{!optyObj.Otter_FFA_Grand_Total_After_GST__c};
$secondFooterRow = $(this.grid.sDiv).find("tr.myfootrow");
$thirdFooterRow = $(this.grid.sDiv).find("tr.myfootrow");
if ($secondFooterRow.length === 0) {
// add second row of the footer if it's not exist
$secondFooterRow = $footerRow.clone();
$secondFooterRow.removeClass("footrow").addClass("myfootrow ui-widget-content");
$secondFooterRow.children("td").each(function () {
this.style.width = ""; // remove width from inline CSS
});
$secondFooterRow.insertAfter($footerRow);
}
if ($thirdFooterRow.length === 0) {
// add second row of the footer if it's not exist
$thirdFooterRow = $secondFooterRow.clone();
$thirdFooterRow.removeClass("footrow").addClass("myfootrow ui-widget-content");
$thirdFooterRow.children("td").each(function () {
this.style.width = ""; // remove width from inline CSS
});
$thirdFooterRow.insertAfter($secondFooterRow);
}
//FIRST FOOTER ROW
$this.jqGrid("footerData", "set", {Description1__c: "Total EX GST:", Otter_FFA_Total_Price__c:f});
//$this.jqGrid("footerData", "set", {Description1__c: "Total XXX GST:", Otter_FFA_Total_Price__c:f});
//SECOND FOOTER ROW
$secondFooterRow.find(">td[aria-describedby=" + this.id + "_Description1__c]").text("GST:");
$secondFooterRow.find(">td[aria-describedby=" + this.id + "_Otter_FFA_Total_Price__c]").text(m);
//THIRD FOOTER ROW
$thirdFooterRow.find(">td[aria-describedby=" + this.id + "_Description1__c]").text("Total INC GST:");
$thirdFooterRow.find(">td[aria-describedby=" + this.id + "_Otter_FFA_Total_Price__c]").text(l);
}
以下是第一次加载页面时的外观:
Total EX GST: $1,141.12
GST: $114.14
Total INC GST: $1255.26
页面
第2页,共2页
视图11-12/12
当我点击下一页或任何其他动作时,它是这样的:
Total EX GST: $1,141.12
Total INC GST: $1255.26
Total INC GST: $1255.26
页面
第2页,共2页
视图11-12/12
任何建议都将不胜感激。我在Salesforce中使用这个jqgrid,但最终只是一个HTML页面。我想上传这些图片,但我是这个社区的新手,所以我不能
谢谢。对于有相同问题的任何人,如果您指定了唯一的Id,那么您可以引用该Id并进行更新。以下是上述问题的解决方案:
loadComplete: function () {//for showing default edit
var $this = $(this), ids = $this.jqGrid('getDataIDs'), i, l = ids.length;
for (i = 0; i < l; i++) {
}
//In order to have three totals
var $this = $(this),
$footerRow = $(this.grid.sDiv).find("tr.footrow"),
$secondFooterRow = $(this.grid.sDiv).find("tr.myfootrow"),
$thirdFooterRow = $(this.grid.sDiv).find("tr.mythirdfootrow");
//$secondFooterRow,$thirdFooterRow;
var f = {!optyObj.Otter_FFA_Total_Before_GST__c};
var m = custFormat({!optyObj.Otter_FFA_Grand_Total_GST__c});
var l = custFormat({!optyObj.Otter_FFA_Grand_Total_After_GST__c});
if ($secondFooterRow.length === 0) {
// add second row of the footer if it's not exist
$secondFooterRow = $footerRow.clone();
$secondFooterRow.removeClass("footrow").addClass("myfootrow ui-widget-content");
$secondFooterRow.attr('id', 'secondFooterRow');
$secondFooterRow.children("td").each(function () {
this.style.width = ""; // remove width from inline CSS
});
$secondFooterRow.insertAfter($footerRow);
}
if ($thirdFooterRow.length === 0) {
// add second row of the footer if it's not exist
$thirdFooterRow = $footerRow.clone();
$thirdFooterRow.removeClass("footrow").addClass("mythirdfootrow ui-widget-content");
$thirdFooterRow.attr('id', 'thirdFooterRow');
$thirdFooterRow.children("td").each(function () {
this.style.width = ""; // remove width from inline CSS
});
$thirdFooterRow.insertAfter($secondFooterRow);
}
//FIRST FOOTER ROW
//$this.jqGrid("footerData", "set", {Description1__c: "Total EX GST:<br><br>GST:<br><br>Total INC GST:", Otter_FFA_Total_Price__c:f}, {Description1__c: "Total EX GST:<br><br>GST:<br><br>Total INC GST:", Otter_FFA_Total_Price__c:f});
$this.jqGrid("footerData", "set", {Description1__c: "Total EX GST:", Otter_FFA_Total_Price__c:f});
//SECOND FOOTER ROW
$secondFooterRow.find(">td[aria-describedby=" + this.id + "_Description1__c]").text("GST:");
$secondFooterRow.find(">td[aria-describedby=" + this.id + "_Otter_FFA_Total_Price__c]").attr('id', 'secondFooterRow_Otter_FFA_Total_Price__c');
$secondFooterRow.find(">td[aria-describedby=" + this.id + "_Otter_FFA_Total_Price__c]").text(m);
//THIRD FOOTER ROW
$thirdFooterRow.find(">td[aria-describedby=" + this.id + "_Description1__c]").text("Total INC GST:");
$thirdFooterRow.find(">td[aria-describedby=" + this.id + "_Otter_FFA_Total_Price__c]").attr('id', 'thirdFooterRow_Otter_FFA_Total_Price__c');
$thirdFooterRow.find(">td[aria-describedby=" + this.id + "_Otter_FFA_Total_Price__c]").text(l);
}
});