jqgrid format number and link in one cell

2019-02-15 06:33发布

Is it possible have a format number as link in a cell with jqGrid? with two formatter number and link/showlink

colModel:[
{name:'Balance',index:'Balance',align:'right',formatter: 'showlink', sorttype:"float", summaryType:'sum', formatoptions:{thousandsSeparator:","}},...

Im trying to set Balance as link and still able to sum up with grouping

TIA

标签: jqgrid
1条回答
ゆ 、 Hurt°
2楼-- · 2019-02-15 06:44

Yes, you can!

You can define custom formatter and call the original "number" and "showlink" formatters inside of the your custom formatters.

For example the demo uses

formatter: function (cellValue, options, rowObject, action) {
    return $.fn.fmatter.call(this, "showlink",
        $.fn.fmatter.call(this, "number", cellValue, options, rowObject, action),
        options,
        rowObject,
        action);
},
formatoptions: { decimalSeparator: ",", baseLinkUrl: "http://www.google.com/"}

How you can see I used options of custom formatter as the corresponding parameter of $.fn.fmatter. So one can use mix from options of "number" and "showlink" formatters inside of formatoptions.

查看更多
登录 后发表回答