Column Formatting Technical Reference

View as Markdown

Format Column State

FormatColumnState

Format Column section of Adaptable State, including Initial State.

Each entry styles cells, changes how a value is displayed, or both. Scope says where it applies. Rule limits it to matching rows; omit Rule to apply it on every row. Style sets colours and fonts. DisplayFormat changes the displayed value.

Extends

BaseState

Format Columns to apply. Several can match the same cell. Their styles are combined, and the first definition in this list wins on a property both set. A Styled Column wins over a Format Column where both set the same property.

Caution

The order of elements is important as it defines their Evaluation Precedence

Format Column

FormatColumn

Colours a cell, changes how its value is displayed, or both.

Scope is required. Style and DisplayFormat can be set together. Omit Rule to apply the format on every row in scope. Target defaults to 'cell' ('columnHeader' formats the header). Suspend with IsSuspended.

When a format applies to a column inside a column group.

Omit it to apply the format whether the parent group is expanded or collapsed. 'Expanded' applies only while the parent group is expanded. 'Collapsed' applies only while it is collapsed. 'Both' applies in either state. A column that is the only leaf of a top-level group ignores an explicit scope.

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

Row kinds to skip. Each flag excludes that kind. When omitted, data, group, summary and total rows are all included.

Rule?

string

AdapTableQL boolean expression (evaluated per row) deciding whether to apply the Format, e.g. [price] > 100; if undefined the Format is always applied

Where Format will be applied: whole Row, some Columns, or Columns of DataType

Colours, font and CSS class applied to the cell or header. Can be set together with DisplayFormat.

Where in Column to apply Format (cell or columnHeader)

Default

'cell'

IsReadOnly?

boolean

Sets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full')

IsSuspended?

boolean

Suspends (i.e. turns off) an Adaptable Object

Scope

ColumnScope

Which columns an object applies to. Set exactly one shape.

One of

Matches every column. All must be true.

{ DataTypes }

('text' | 'number' | 'boolean' | 'date' | 'textArray' | 'numberArray')[]

Data types to match, for example ['number'] or ['text', 'textArray']. Object, tuple and unknown columns are not scope data types. Name those columns with ColumnIds.

Column ids to match. These are AG Grid colId values.

AG Grid column type names, the strings set on colDef.type.

ColumnGroupScope is a ColumnGroupScope:

Value
'Expanded'
'Collapsed'
'Both'

RowScope is a RowScope:

RowScope

Row kinds to skip.

Each flag, when true, skips that kind. A flag left unset includes that kind. When the whole RowScope is omitted, the feature decides: a Format Column includes every kind.

Exclude regular data rows

Exclude Group Rows

Exclude Summary Rows (used in Row Summaries)

Exclude Grand Total Rows (used in Aggregations)

Target is a FormatColumnTarget:

Value
'cell'
'columnHeader'

DisplayFormat is an AdaptableFormat: a NumberFormatter, DateFormatter, or StringFormatter, each with its own Options.

Style

Each Style object is an Adaptable Style which defined as follows:

AdaptableStyle

Colours, font and border for a cell, header or highlight.

Text properties (ForeColor, FontWeight, FontStyle, TextDecoration, FontSize, Alignment) and box properties (BackColor, BorderColor, BorderRadius) are applied together. ClassName adds a CSS class and does not turn the other properties off. A Styled Column can take just the text slice (Font) or just the box slice (Cell).

ClassName?

string

CSS class added to the cell. Colour, font and border properties on this object are still applied.

Display Formats

The DisplayFormat property is of type AdaptableFormat which can be one of 3 objects:

Numeric Format

The numberformatteroptions provides Numeric Display Formats :

NumberFormatterOptions

Formatter Options for Numeric Columns

Extends

BaseFormatterOptions

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

Number of digits to show in Fractions (up to 20)

Separator to use in fractions

Number of digits to show for Integers (up to 20)

Separator to use in Integers

Multiplier?

number

Multiplier to use on cell value

Notation?

'standard' | 'scientific'

Numeric notation to use when rendering the value.

- 'standard' (default) — renders the number normally.
- 'scientific' — renders the number in scientific notation
(e.g. 1.23e+5). When set, IntegerSeparator is ignored
and FractionDigits controls the number of mantissa digits.

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

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 :

StringFormatterOptions

Formatter Options for String Columns

Extends

BaseFormatterOptions

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 :

DateFormatterOptions

Formatter Options for Date Columns - contains a single Pattern property

Extends

BaseFormatterOptions

Pattern?

string

Pattern to use for Date Format


Format Column Options

Custom Display Formatters


Format Column API

FormatColumnApi

Format Columns: the display format and style applied to a column, including which formats are active.

Adds a Format Column to Format Column State

Adds Format Columns to Format Column State

Moves a Format Column down so the formats above it are applied first.

Deletes all Format Columns in the State

Deletes an existing Format Column

Edits the Format Column

Format Columns that match the given criteria.

Retrieves all active (not-suspended) Format Columns in Adaptable State

Retrieves the first Format Column's Adaptable Format for a given Column

Retrieves a Format Column by its Name

Retrieves Format Column by the technical ID (from FormatColumnState)

Retrieves all Format Columns in Adaptable State

Gets all FormatColumns which are defined for the given column

Gets all FormatColumns which are defined for the column with the given columnId

Retrieves Format Column section from Adaptable State

Retrieves all suspended Format Columns in Adaptable State

Checks if a Format Column contains a Custom Display Formatter

Moves a Format Column up so it is applied before the formats below it.

Opens Settings Panel with Format Column section selected and visible

Suspends all Format Columns

Suspends an Format column

Activates all suspended Format Column

Activates a suspended Format Column.