私はこの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 が定義されていません」というエラーが発生します。
この問題を解決するにはどうすればよいですか?