jqgrid format number and link in one cell

前端 未结 1 1851
予麋鹿
予麋鹿 2021-01-06 13:28

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\'         


        
相关标签:
1条回答
  • 2021-01-06 13:38

    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.

    0 讨论(0)
提交回复
热议问题