Caplin Trader 5.1.0

Class: module:ct-element/formatter/InvalidPriceFormatter

module:ct-element/formatter/InvalidPriceFormatter()

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

Substitutes a token for the value if it is not a valid price.

InvalidPriceFormatter is typically used in the XML Renderer Framework, but can be invoked programmatically as in the following example which evaluates to "-":

InvalidPriceFormatter.format("0", {invalidPrice:"-"})
Implements:

Methods

format(vValue, mAttributes) → {String}

Substitutes a token for the value if it is not a valid price (a positive number).

Parameters:
Name Type Description
vValue Variant

the price (String or Number type).

mAttributes Map

the map of attributes.

Properties
Name Type Attributes Default Description
invalidPrice String <optional>
''

the replacement text in case of an invalid price.

Implements:
Returns:

the replacement text in case of an invalid price, otherwise the unchanged price.

Type
String