Singleton
caplin.element.formatter

TemplateFormatter

Formats a value using a template.

Constructor Summary

Attributes Name and Description
caplin.element.formatter.TemplateFormatter()

Method Summary

Attributes Name and Description
String format(Variant vValue, Map mAttributes)

Formats a value using a template, using the token {0} to represent the field value.

Constructor Detail

caplin.element.formatter.TemplateFormatter()

Method Detail

String format(Variant vValue, Map mAttributes)

Formats a value using a template, using the token {0} to represent the field value. TemplateFormatter is typically used in the XML Renderer Framework, but can be invoked programmatically as in the following example which evaluates to "30 Year":

caplin.element.formatter.TemplateFormatter.format(30, {template: "{0} Year")

Attribute Options:

Option Description
template the template to use

Parameters
Variant vValue the string.
Map mAttributes the map of attributes.
Returns
the string, formatted using the template.