2013-10-17 92 views
2

我想在自定义格式器中使用预定义格式器。jqGrid:在自定义格式器中使用预定义格式器

例如,这是colModel:

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

,这是格式化:

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'; 
    } 
} 

这可能吗? 谢谢。

回答

5

是的,你可以做到这一点通过调用

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