我正在使用这个 jqgrid:
$("#griglia-navgrid").jqGrid( {
colNames:[...],
colModel:[ {name:'ZMENG_SOR_VRKME_PREC', index:'ZMENG_SOR_VRKME_PREC', width:'5', sortable:false, formatter:numFormat}, ],
...
footerrow:true,
afterInsertRow: function(id){ $("#griglia-navgrid").jqGrid('setCell',id,'ZPARVW_Z1','',{'text-decoration':'underline'}); },
loadComplete: function () {
var $this = $(this),
sum = $this.jqGrid("getCol", "ZMENG_SOR_VRKME", 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) {
$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);
}
for (i = 0; i < totalRows; i++) {
if(localData[i].ZMENG_SOR_VRKME.search("-") == -1){
totalSum += parseFloat(localData[i].ZMENG_SOR_VRKME);}
else{
totalSum -= parseFloat(localData[i].ZMENG_SOR_VRKME);
}
}
$newFooterRow.find(">td[aria-describedby=" + this.id + "_ZPARVW_Z1_NAME]").text("Totale:");
$newFooterRow.find(">td[aria-describedby=" + this.id + "_ZMENG_SOR_VRKME]").text(
$.fmatter.util.NumberFormat(totalSum, $.jgrid.formatter.number.decimalSeparator=',')
);
}
}); //jqGrid
function numFormat( cellvalue, options, rowObject ){
return cellvalue.replace(".",",");
}
它适用于 Safari 和 Chrome。在 Firefox 中我有一个错误:“ReferenceError:numFormat 未定义”。
我该如何解决这个问题?