Format Columns
Summary
- The Format Column module controls how column values read and how cells look in AG Grid
- Each definition can include a Display Format, an Style, or both
- Definitions are scoped to columns, data types, or whole rows; an optional Condition limits when a rule applies
- Multiple Format Columns can apply to the same column; AdapTable composes matching rules and uses precedence when properties clash
The Format Column module lets users control how values read and how cells look in AG Grid.
This Module is used by AdapTable for 2 main types of formatting:
- Display Formats - formats the display value of a Cell
- Cell Styling - colours, fonts, alignment etc.
Note
- There are a few other styling-related functionalities in AdapTable including:
- Six Styled Columns (dedicated renderers for charts, gradients, percent bars, badges etc.)
- Flashing Cells (short-lived highlights).
- Quick Search highlights matching cells in a search
- A comprehensive Theming Module to style the AdapTable UI (i.e. all wizards and popups)
The style specified in Column Formatting has the lowest level of precedence when AdapTable applies styling.
Deep Dive
Style Precedence in AdapTable
Each Format Column definition shares the same building blocks:
- Scope — which columns, data types, or whole rows are in scope (see Scope below)
- Target — cell or column header
- Display Format and/or Style — how values read and how cells look (not mutually exclusive)
- Condition — optional rule; most often used with styles (see Conditional Styling)
- Row scope — data rows, group rows, summaries, and related settings
Note
- Format Columns apply to all column types including Calculated and Free Text columns
- Formatted columns remain editable and filterable when those features are enabled on the column
- A Format Column can be limited to specific Layouts via Layout Extensions
Topics in this Section
Format Column behaviour is split across several handbook pages. Display format types (numeric, string, date, template, custom) are listed on Applying Display Formats.
| Topic | Summary |
|---|---|
| Display Formats | How cell text is shown — presets, formatters, templates, and custom display formatters |
| Custom Display Format | Register customDisplayFormatters in Adaptable Options; reference by id from state or the wizard |
| Template Formats | [value], [column], [rowData.x] template literals in display format options |
| Styles | Colours, fonts, alignment, borders, optional CSS classes |
| Conditional Styling | Boolean rules; includes $SCOPE for type-wide rules |
| Observable Conditions | Rules driven by change history / time |
| Configuring Column Formatting | Composition, precedence, row and column-group scope |
| Column Headers | Format column header text and style (no conditions on headers) |
| Technical Reference | State, formatColumnOptions, Format Column API |
Also in Cell Rendering
| Topic | Summary |
|---|---|
| Styled Columns | Gradient, percent bar, badge, sparkline, and other renderer columns |
| Flashing Cells | Temporary highlight when data or observables change |
- This example contains a mixture of different Column Formats and Styles:
Namehas an Adaptable Style of BoldGithub Starshas a Display Format (showing a Prefix) and Adaptable Style for both fore and back colours- All
Datecolumns have a Display Format of 'MMM do yyyy' applied - A Blue Style has been set for the Whole Row, using a Condition:
[language] = "TypeScript" AND [license] = "MIT License"
Scope
Scope defines where the Format Column is applied.
Scope is provided by the commonly-used Column Scope Object which provides 4 sets of options:
-
All Columns - The entire Row can be rendered with a Format Column (by providing a Scope of 'All')
-
Columns - consists of a list of Column Names which will display the Style
-
Column Types - applies style to all Columns that share a supplied Column Type
-
Data Types - applies style to all Columns which share supplied Cell Data Type (e.g.
text,numberordate)
Hint
Use this to give all dates a distinctive format, or apply a condition to all numbers, e.g. Green Positive / Red Negative
- This demo showcases how to use Scope in Format Columns
- The
Issue ChangeColumn has 2 Format Conditions applied (Green for Positive and Red for Negative) - All Columns of DataType
Datehave a Display Format (of 'MMM do yyyy') - Columns with a ColumnType of 'Github' (i.e.
Github Watchers&Github Stars) are italicised and centre-aligned - Whole Rows are styled to match an Expression ('[language] = "TypeScript" AND [license] = "MIT License" ')
- The
Composition
Each Column will render every Format Column for which it is in Scope.
This means that a Column can successfully display 2 (or more) Format Columns.
Note
If a Column is in scope for 2 clashing Format Columns, AdapTable renders the Format Column with higher precedence
Find Out More
See Configuring Formatting for further details on composition and also order of precedence betweeen Formats
Condition
By default, a Format Column applies to every cell in scope.
An optional Rule limits application to matching rows — commonly for conditional highlighting (e.g. negative P&L, limit breaches).
The same Rule mechanism can also be used for Display Formats (though that is less common).
Find Out More
See Conditional Styling for Expressions, and demos
Using Column Formats
Run-time users are able to add, edit, share, suspend and delete Format Columns using the relevant section in the Settings Panel.
Note
There are no Toolbars or Tool Panels for Format Columns
A Menu Item in the Column Menu opens the relevant Wizard.
Hint
- When Creating Format Columns the
Create Format Columnmenu item appears in every Column Menu - When Editing each existing Format Column has an
Edit Format ColumnColumn Menu Item
The Format Column Wizard enables creating and editing Format Columns.
UI Step by Step Guide
Using the Format Column Wizard
AG Grid Rendering
AG Grid provides very powerful, custom column display functionality.
These include Value Getters, Value Formatters and Cell Components (previously called Cell Renderers)
All of these will work in AdapTable and nothing will be lost.
However despite the richness of the AG Grid rendering capabilities we recommend not using AG Grid's Value Formatters or Cell Components, if possible.
Instead use AdapTable's Styling and Formatting features as they integrate more tightly into the tool.
Find Out More
See the Tutorial on AG Grid Cell Rendering for more information and examples
UI Entitlements
The UI Entitlements behaviour for Format Columns is as expected for Full and Hidden Access Levels.
The ReadOnly Entitlement behaviour is that the Columns will still be rendered but Users are not permitted to manage or suspend the Format Column definitions.
FAQ
Can I apply more than one Format to a column? Yes — a column can match several Format Column definitions at once. Styles (and general settings such as alignment) are merged; clashing properties follow precedence order (see Configuring Column Formatting). Display formats are not merged: the definition with higher precedence wins when more than one applies.
Can I use Format Column to display a different caption for the Column?
Yes, you can format a Column Header including providing a custom Caption.
But it is preferable to do this by using the ColumnHeaders property in a Layout
Why is the Style or Format not being applied in Aggregated values?
Check that you have not set ExcludeGroupRows to true in the RowScope property in the Format Column Definition