Keeping the currency formatted JQgrid cell blank without default value if no is value returned

匆匆过客 提交于 2020-01-25 11:49:30

问题


once of the the cells in my jqgrid is currency formatted with the formatoptions:{decimalSeparator:".", thousandsSeparator: ",", decimalPlaces: 2, prefix: "$ ",defaultValue:''}

This is the case when I have a value for it But in cases where I don't have a value to that particular field Grid by default takes $0.00 I would like to keep it blank instead of filling with a default value ie $0.00

How can I do that? After looking up some question I went with the custom formatter

if (cellValue != 0.00) 


  {

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

}
else
{

    return "";
}

in this case how can I add $ as the prefix?? and ofcourse sorting on this field is not working. Looking forward to a quick help and fix from someone thanks in advance!!


回答1:


You can use $.fn.fmatter.call(this, "currency", cellValue, options) inside of custom formatter instead of the usage of $.fmatter.util.NumberFormat.



来源:https://stackoverflow.com/questions/25694109/keeping-the-currency-formatted-jqgrid-cell-blank-without-default-value-if-no-is

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