Caplin Trader 5.1.0

Class: module:ct-element/formatter/TemplateFormatter

module:ct-element/formatter/TemplateFormatter()

new module:ct-element/formatter/TemplateFormatter()

Formats a value using a template.

Implements:

Methods

format(vValue, mAttributes) → {String}

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":
TemplateFormatter.format(30, {template: "{0} Year")

Parameters:
Name Type Description
vValue Variant

the string.

mAttributes Map

the map of attributes.

Properties
Name Type Description
template Map

the template to use.

Implements:
Returns:

the string, formatted using the template.

Type
String