format

Sets the data format.

Type

One of the format constants below:

StyleConstant.DATE_FORMAT

date display

StyleConstant.DECIMAL_FORMAT

number display

StyleConstant.MESSAGE_FORMAT

text display

StyleConstant.PERCENT_FORMAT

fraction display

StyleConstant.CURRENCY_FORMAT

locale-adapting currency display

To format cells or columns of a Table, use the tableLens property.

For the Date, Decimal, and Message formats, use the formatSpec property to assign a format specification using the appropriate masks.

Example

// Number format
format = StyleConstant.DECIMAL_FORMAT;
formatSpec = "#,###.00";

// Text format
format = StyleConstant.MESSAGE_FORMAT;
formatSpec = "{0} Inc."

Either syntax below can be used in component script:

format               // unqualified
Component1.format    // qualified

For onInit/onRefresh scripts, and for component and property scripts on other components, the second (qualified) form is required.