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:

PropertyTypeDescription
FormatColumnsFormatColumn[]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:

PropertyTypeDescriptionDefault
ColumnGroupScopeColumnGroupScopeWhen to format Columns in Column Groups ('Expanded', 'Collapsed', 'Both')
DisplayFormatDisplayFormatDisplay 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.
NamestringName of the Format Column definition
RowScopeRowScopeWhich types of Rows to apply format (data, grouped, summary, total)
RuleFormatColumnRuleRule to decide whether to apply Format; if undefined Format is always applied
ScopeColumnScopeWhere Format will be applied: whole Row, some Columns, or Columns of DataType
StyleAdaptableStyleAdapTable Style to apply
TargetFormatColumnTargetWhere in Column to apply Format (cell or columnHeader)'cell'
IsReadOnlybooleanSets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full')
IsSuspendedbooleanSuspends (i.e. turns off) an Adaptable Object

Style

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

PropertyTypeDescription
ClassNamestringExisting 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 :

PropertyTypeDescription
AbsbooleanReturns absolute value of cell value
CeilingbooleanReturns smallest integer greater than cell value
Contentstring | numberReplaces cell value with supplied value (that can contain Template Literals)
EmptybooleanShow nothing in cell (but underlying value remains)
FloorbooleanReturns largest integer cell value
FractionDigitsnumberNumber of digits to show in Fractions (up to 20)
FractionSeparatorstringSeparator to use in fractions
IntegerDigitsnumberNumber of digits to show for Integers (up to 20)
IntegerSeparatorstringSeparator to use in Integers
MultipliernumberMultiplier to use on cell value
Notation'standard' | 'scientific'Numeric notation to use when rendering the value.
ParenthesesbooleanShows negative numbers in parentheses
PrefixstringPrefix to use before cell value
RoundbooleanRounds cell value
SuffixstringSuffix to use after cell value
TruncatebooleanTruncates cell value
ZeroDisplaystringWhen 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 :

PropertyTypeDescription
Case'Upper' | 'Lower' | 'Sentence'Sets text to Upper, Lower or Sentence case
ContentstringReplaces cell value; useful when using Condition (e.g. replace null with 'N/A')
EmptybooleanShow nothing in cell (but underlying value remains)
PrefixstringPrefix to use before the cell text
SuffixstringSuffix to use after the cell text
TrimbooleanTrims text (both start and end)

Date Format

The dateformatteroptions provides Date Display Formats :

PropertyTypeDescription
PatternstringPattern to use for Date Format

Format Column Options

The Format Column Options section of Adaptable Options is used to provide Custom Display Formats:

PropertyTypeDescription
customDisplayFormattersCustomDisplayFormatter[]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:

MethodReturnsDescription
addFormatColumn(formatColumn)FormatColumnAdds a Format Column to Format Column State
addFormatColumns(formatColumns)FormatColumn[]Adds Format Columns to Format Column State
decrementFormatColumnPrecedence(formatColumn)voidDecrement the precedence of the given FormatColumn
deleteAllFormatColumns()voidDeletes all Format Columns in the State
deleteFormatColumn(formatColumn)voidDeletes an existing Format Column
editFormatColumn(formatColumn)FormatColumnEdits 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 | undefinedRetrieves the first Format Column's Adaptable Format for a given Column
getFormatColumnByName(name)FormatColumn | undefinedRetrieves a Format Column by its Name
getFormatColumnByUuId(id, config)FormatColumnRetrieves 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()FormatColumnStateRetrieves Format Column section from Adaptable State
getSuspendedFormatColumns(config)FormatColumn[]Retrieves all suspended Format Columns in Adaptable State
hasCustomDisplayFormatter(formatColumn)booleanChecks if a Format Column contains a Custom Display Formatter
incrementFormatColumnPrecedence(formatColumn)voidIncrement the precedence of the given FormatColumn
openFormatColumnSettingsPanel()voidOpens Settings Panel with Format Column section selected and visible
suspendAllFormatColumn()voidSuspends all Format Columns
suspendFormatColumn(formatColumn)FormatColumnSuspends an Format column
unSuspendAllFormatColumn()voidActivates all suspended Format Column
unSuspendFormatColumn(formatColumn)FormatColumnSuspends an Format column