Configuring Free Text Columns
Summary
- Free Text Columns can be defined at design-time using Free Text Column Initial State
- The Free Text Column API can be used to add values programmatically at run-time
Defining Free Text Columns
Free Text Columns can be defined in Free Text Column Initial Adaptable State.
Each FreeTextColumn object contains 2 useful properties that can be provided if required:
FreeTextStoredValues- allows the Free Text Column to be 'pre-populated' with relevant dataDefaultValue- enables each cell to display a default value unless explicitly overridden by the User
Developer Guide
Defining a Free Text Column
There are (up to) 6 properties that you need to provide:
// Provide 3 Free Text Columns
// 1. OpsNote - string column with 3 initial values
// 2. OrderCode - numeric column with default of 123
// 3. LastSpoken - a date Column
const initialState: InitialState = {
FreeTextColumn: {
FreeTextColumns: [
{
ColumnId: 'OpsNote',
FriendlyName: 'Ops Note',
FreeTextStoredValues: [
{ PrimaryKey: 12, FreeText: 'Dispatch asap' },
{ PrimaryKey: 15, FreeText: 'Angry client' },
{ PrimaryKey: 21, FreeText: 'Big order' },
],
FreeTextColumnSettings: {
DataType: 'text',
Aggregatable: false,
},
},
{
ColumnId: 'OrderCode',
FriendlyName: 'Order Code',
DefaultValue: 123,
FreeTextColumnSettings: {
DataType: 'number',
Sortable: false,
SuppressMenu: true,
},
},
{
ColumnId: 'LastSpoken',
FriendlyName: 'Last Spoken',
FreeTextColumnSettings: {
DataType: 'date',
Filterable: true,
},
},
],
},
}
This value is used to refer to the Column in State
This value is used to refer to the Column in AdapTable UI
Whether the Column is Text Number Date or Boolean
Is only mandatory property in FreeTextColumnSettings
AdapTable provides an appropriate Cell Editor based on the DataType provided here
Used in each cell unless explicitly overridden by the User
Initial values to show in the column.
Each is keyed against the Primary Key value for the Row.
Provide additional settings for the Column (e.g. filterable, pivotable, resizable, sortable etc.)
Hint
- To prevent filtering on Free Text Columns, set
enableFilterOnSpecialColumnsto false in Column Filter Options - This will also disallow filtering on all Calculated Columns and Action Columns
Adding Values Programmatically
A commonly used function in Free Text Column API is setStoredValues which allows you to update values stored in Free Text Columns programmatically.
setStoredValues
columnId: string, values: FreeTextStoredValue[], action: 'All' | 'Conflicting' | 'None'void- The demo starts with 3 Stored Values in the
Ops NoteFreeText Column - Each toolbar button applies the same payload : update
Angular(PK24195339), and addReact(PK10270250) - with a differentreplaceAction:- None — only adds the new Stored Value; existing ones are left unchanged
- Conflicting — updates the overlapping Stored Value and adds the new one; other Stored Values remain
- All — replaces every Stored Value with just the payload
- Use Reset to restore the initial 3 Stored Values (
replaceAction: 'All')
Click None, then Reset, and compare with Conflicting and All
AG Grid Column Definitions
Typically Free Text Columns are provided only in Initial Adaptable State and not also defined in Grid Options.
However sometimes it is required to define the Free Text Column in AG Grid - e.g. if you want to show an AG Grid tooltip on the cell value.
This is possible by specifying a Column Type of freeTextColumn in the AG Grid Column Definition.
Hint
Make sure ColId in the Column Definition and ColumnId in the Custom Column definition are the same value
Find Out More
See Adding Special Column Types for more details and an accompanying demo