简体   繁体   English

jqGrid:在自定义格式化程序中使用预定义的格式化程序

[英]jqGrid: using a predefined formatter inside a custom formatter

I would like to use a predefined formatter inside a custom formatter. 我想在自定义格式器中使用预定义的格式器。

For example, this is the colModel: 例如,这是colModel:

colModel: [
  ...
  { name: 'col1', formatter: myFormatter }
  ...
]

and this is the formatter: 这是格式化程序:

function myFormatter(cellValue, options, rowObject) {
  if (typeof cellValue === 'number') {
    // Here I want to call the "currency" predefined formatter on the cellValue

  } else {
    return 'No number to display';
  }
}

Is it possible? 可能吗? Thank you. 谢谢。

是的,您可以致电

return $.fmatter.util.NumberFormat(cellValue, $.jgrid.formatter.currency)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM