Field Render to trim trailing zeroes?

I’m trying to get a number field to display as currency, but with a custom number of places after the decimal. Essentially trying to trim the trailing zeroes for display purposes. Here’s my code but it doesn’t work. The field is defined with 8 decimals and it always displays with 8 decimals regardless of the actual value:

var field = arguments[0]; var value = arguments[1]; field.element.css({'text-align': 'right'}); if (value == null || value == 0) { skuid.ui.fieldRenderers.CURRENCY[field.mode](field,value); } else { value = value.toString(); var valLen = value.length; var displayValue = (Number(value).toFixed(valLen-2)); skuid.ui.fieldRenderers.CURRENCY[field.mode](field,displayValue); } 

This should do it.

var NUMBER_OF_DECIMAL_PLACES = 2; var field = arguments[0]; var value = arguments[1]; field.element.css({'text-align': 'right'}); if (value == null || value == 0) { skuid.ui.fieldRenderers.CURRENCY[field.mode](field,value); } else { field.metadata.scale = NUMBER_OF_DECIMAL_PLACES; skuid.ui.fieldRenderers.CURRENCY[field.mode](field,value); } 

Worked, thanks!