Column Formatting Technical Reference
Summary
- Column Formats and Styles are defined in Format Column Initial Adaptable State
- Custom Display Formats can be provided in Format Column Options
- Run-time access to Formats and Styles is via the Format Column API Section of Adaptable API
Format Column State
The Format Column section of Initial Adaptable State contains a collection of FormatColumn objects:
| Property | Type | Description |
|---|---|---|
| FormatColumns | FormatColumn[] | Collection of Format Columns |
Caution
The order of elements is important as it defines their Evaluation Precedence
Format Column
Each Format Column object is defined as follows:
| Property | Type | Description | Default |
|---|---|---|---|
| ColumnGroupScope | ColumnGroupScope | When to format Columns in Column Groups ('Expanded', 'Collapsed', 'Both') | |
| DisplayFormat | DisplayFormat | Display Format to apply to Column. Can be a concrete AdaptableFormat (Numeric, String or Date) or the name of a numeric preset such as 'Percentage', 'Thousand', 'Million', 'Dollar', 'Sterling', which is resolved at render time. | |
| Name | string | Name of the Format Column definition | |
| RowScope | RowScope | Which types of Rows to apply format (data, grouped, summary, total) | |
| Rule | FormatColumnRule | Rule to decide whether to apply Format; if undefined Format is always applied | |
| Scope | ColumnScope | Where Format will be applied: whole Row, some Columns, or Columns of DataType | |
| Style | AdaptableStyle | AdapTable Style to apply | |
| Target | FormatColumnTarget | Where in Column to apply Format (cell or columnHeader) | 'cell' |
| IsReadOnly | boolean | Sets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full') | |
| IsSuspended | boolean | Suspends (i.e. turns off) an Adaptable Object |
Style
Each Style object is an Adaptable Style which defined as follows:
| Property | Type | Description |
|---|---|---|
| ClassName | string | Existing CSS Class; use instead of setting other object properties |
Display Formats
The DisplayFormat property is of type AdaptableFormat which can be one of 3 objects:
Numeric Format
The numberformatteroptions provides Numeric Display Formats :
| Property | Type | Description |
|---|---|---|
| Abs | boolean | Returns absolute value of cell value |
| Ceiling | boolean | Returns smallest integer greater than cell value |
| Content | string | number | Replaces cell value with supplied value (that can contain Template Literals) |
| Empty | boolean | Show nothing in cell (but underlying value remains) |
| Floor | boolean | Returns largest integer cell value |
| FractionDigits | number | Number of digits to show in Fractions (up to 20) |
| FractionSeparator | string | Separator to use in fractions |
| IntegerDigits | number | Number of digits to show for Integers (up to 20) |
| IntegerSeparator | string | Separator to use in Integers |
| Multiplier | number | Multiplier to use on cell value |
| Notation | 'standard' | 'scientific' | Numeric notation to use when rendering the value. |
| Parentheses | boolean | Shows negative numbers in parentheses |
| Prefix | string | Prefix to use before cell value |
| Round | boolean | Rounds cell value |
| Suffix | string | Suffix to use after cell value |
| Truncate | boolean | Truncates cell value |
| ZeroDisplay | string | When the numeric value is zero (after multiplier and rounding): - omitted / undefined, or '0' — use normal formatting (e.g. 0, 0.00) - '' — show a blank cell (user cleared the default 0 in the wizard) - any other string — show that text (e.g. -, —) |
String Format
The stringformatteroptions provides String Display Formats :
| Property | Type | Description |
|---|---|---|
| Case | 'Upper' | 'Lower' | 'Sentence' | Sets text to Upper, Lower or Sentence case |
| Content | string | Replaces cell value; useful when using Condition (e.g. replace null with 'N/A') |
| Empty | boolean | Show nothing in cell (but underlying value remains) |
| Prefix | string | Prefix to use before the cell text |
| Suffix | string | Suffix to use after the cell text |
| Trim | boolean | Trims text (both start and end) |
Date Format
The dateformatteroptions provides Date Display Formats :
| Property | Type | Description |
|---|---|---|
| Pattern | string | Pattern to use for Date Format |
Format Column Options
The Format Column Options section of Adaptable Options is used to provide Custom Display Formats:
| Property | Type | Description |
|---|---|---|
| customDisplayFormatters | CustomDisplayFormatter[] | Custom Formatters to use in Format Column Module |
Format Column API
The Format Column API section of Adaptable API is primarily used to format and style columns and manage conditions:
| Method | Returns | Description |
|---|---|---|
| addFormatColumn(formatColumn) | FormatColumn | Adds a Format Column to Format Column State |
| addFormatColumns(formatColumns) | FormatColumn[] | Adds Format Columns to Format Column State |
| decrementFormatColumnPrecedence(formatColumn) | void | Decrement the precedence of the given FormatColumn |
| deleteAllFormatColumns() | void | Deletes all Format Columns in the State |
| deleteFormatColumn(formatColumn) | void | Deletes an existing Format Column |
| editFormatColumn(formatColumn) | FormatColumn | Edits the Format Column |
| findFormatColumns(formatColumnLookupCriteria) | FormatColumn[] | Find all Flashing Cell Definitions which match the given criteria |
| getActiveFormatColumns(config) | FormatColumn[] | Retrieves all active (not-suspended) Format Columns in Adaptable State |
| getDisplayFormatForColumn(column, config) | AdaptableFormat | undefined | Retrieves the first Format Column's Adaptable Format for a given Column |
| getFormatColumnByName(name) | FormatColumn | undefined | Retrieves a Format Column by its Name |
| getFormatColumnByUuId(id, config) | FormatColumn | Retrieves Format Column by the technical ID (from FormatColumnState) |
| getFormatColumns(config) | FormatColumn[] | Retrieves all Format Columns in Adaptable State |
| getFormatColumnsForColumn(column, config) | FormatColumn[] | Gets all FormatColumns which are defined for the given column |
| getFormatColumnsForColumnId(columnId, config) | FormatColumn[] | Gets all FormatColumns which are defined for the column with the given columnId |
| getFormatColumnState() | FormatColumnState | Retrieves Format Column section from Adaptable State |
| getSuspendedFormatColumns(config) | FormatColumn[] | Retrieves all suspended Format Columns in Adaptable State |
| hasCustomDisplayFormatter(formatColumn) | boolean | Checks if a Format Column contains a Custom Display Formatter |
| incrementFormatColumnPrecedence(formatColumn) | void | Increment the precedence of the given FormatColumn |
| openFormatColumnSettingsPanel() | void | Opens Settings Panel with Format Column section selected and visible |
| suspendAllFormatColumn() | void | Suspends all Format Columns |
| suspendFormatColumn(formatColumn) | FormatColumn | Suspends an Format column |
| unSuspendAllFormatColumn() | void | Activates all suspended Format Column |
| unSuspendFormatColumn(formatColumn) | FormatColumn | Suspends an Format column |