1

For some reason all my cfgrids drop the ending 0 of dollar amounts. So 104.50 is coming up as 104.5 and 332.80 is coming up as 332.8

It displays the last digit if it is not a 0. So 345.43 is fine.

I have tried using the currency type but that only works with flash grids.

This seems like an easy problem but I am stuck and everything I am trying is not working.

Any help on this would be great.

Thanks!

Sequenzia
  • 2,333
  • 9
  • 40
  • 59

1 Answers1

0

This is for CF9 (ExtJS 3.x).

<cfsavecontent variable="formatGridInit">
<script language="javaScript">
formatgrid = function() {
    var myFormatter = Ext.util.Format.numberRenderer('.00');
    var mygrid = ColdFusion.Grid.getGridObject('testgrid');
    var cm = mygrid.getColumnModel();
    cm.setRenderer(2, myFormatter);
    mygrid.reconfigure(mygrid.getStore(),cm);
};
</script>
</cfsavecontent>
<cfhtmlhead text="#formatGridInit#">
<cfset ajaxOnLoad("formatgrid")>

Make sure your HTML has <head></head> in order for <cfhtmlhead> to work.

replace testgrid with your grid's name, and 2 on 2nd last line to the column index you want to apply the formatter to.

Henry
  • 32,689
  • 19
  • 120
  • 221