jqgrid format number and link in one cell

情到浓时终转凉″ 提交于 2019-12-30 07:16:09

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/17640140/jqgrid-format-number-and-link-in-one-cell

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!