Skip to content

Instantly share code, notes, and snippets.

@zachelrath
Created April 15, 2013 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zachelrath/5391363 to your computer and use it in GitHub Desktop.
Save zachelrath/5391363 to your computer and use it in GitHub Desktop.
Inline Snippet field renderer for Skuid --- eliminates decimal places on any Double, Percent, or Currency display type fields that it is applied to
var field = arguments[0],
value = arguments[1],
metadata = field.metadata,
dt = metadata.displaytype;
// For currency, double, and percent fields,
// manually override the field's metadata
// related to how many decimal points to display
if (dt == 'CURRENCY' || dt == 'DOUBLE' || dt == 'PERCENT') {
metadata.scale = 0;
}
// Run the field's default renderer
skuid.ui.fieldRenderers[dt][field.mode](field,value);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment