【发布时间】:2026-01-26 00:40:01
【问题描述】:
var jqGridModel = [
{ name: 'month', index: 'Month', width: 120, sorttype: "String", hidden: true }, //hidden column
{name: 'monthID', index: 'MonthID', width: 120, sorttype: "int", formatter: convertToMonthName },
{ name: 'amount', type: "Decimal", index: 'amount', width: 120, sorttype: "float", formatter: 'currency', formatoptions: { decimalSeparator: fmtr[0], thousandsSeparator: fmtr[1], decimalPlaces: 2, suffix: fmtr[3], prefix: fmtr[2]} },
];
fmtr 是我定义的用于处理多种货币的自定义方法。
在上面的网格上,我希望在金额值旁边的金额列内有一个图像。点击这张图片,它会带你到另一个页面,该页面将显示金额的详细信息(分解)。
由于我已经使用了“货币”格式化程序,我不确定是否可以在该列上使用自定义格式化程序。实现这一目标的选择是什么。
我想像这样将图像添加到后缀:
// suffix: fmtr[3] + "<img src='../Content/img/show-detail-icon.png'/> onclick='showDetails'"
但是在这种情况下,我不知道如何将monthID传递给onclick函数。
【问题讨论】: