Calculated Column Config

The Predefined Configuration for the Calculated Column function.

Contains a single Calculated Columns array.

Calculated Column State

PropertyDescriptionDefault
CalculatedColumnsCollection of Calculated Columnsempty

Calculated Column Object

PropertyDescription
CalculatedColumnSettingsAddtional optional properties for Column (e.g. filterable, resizable)
ColumnExpressionExpression which AdapTable parser uses to evaluate Column' display value
ColumnIdName of Calculated Column
FriendlyNameName to be used in Column Header; if blank ColumnId is used

Calculated Column Settings

PropertyDescriptionDefault
AggregatableWhether Column can be used in an aggregation when groupingtrue
DataTypeExpression's return value DataType; inferred by AdapTable but setable by User
FilterableWhether Column is filterabletrue
GroupableWhether Column can be groupedtrue
PivotableWhether Column can be used when grid is in pivot modetrue
ResizableWhether Column can be resized (by dragging column header edges)true
ShowToolTipShow underlying Expression as ToolTip when hovering over a cellfalse
SortableWhether Column is sortabletrue
WidthPreferred width (in pixels) for Column; if unset is calculated dynamically by underlying Grid

Calculated Column Config Example

const demoConfig: PredefinedConfig = {
CalculatedColumn: {
CalculatedColumns: [
{
ColumnExpression: '[ItemCost] / [ItemCount]',
ColumnId: 'AvgCost',
FriendlyName: 'Avg Item Cost',
},
{
ColumnExpression: '([ItemCost] * [ItemCount])- [PackageCost]',
ColumnId: 'Profit',
FriendlyName: 'profit',
},
{
ColumnExpression: '[ItemCost] > 100 ? "High" : [ItemCost] > 50 ? "Medium": "Low"',
ColumnId: 'Comment',
FriendlyName: 'Comment',
CalculatedColumnSettings: {
DataType: 'String',
Filterable: true,
Groupable: true,
Sortable: true,
},
},
{
ColumnExpression: 'max([ItemCost], [OrderCost], ([PackageCost]*10))',
ColumnId: 'HighCost',
FriendlyName: 'Highest Cost',
},
{
ColumnExpression: "[ShippedDate] > ADD_DAYS([OrderDate] , 21) ? 'Late' : 'On time'",
ColumnId: 'ShipDelay',
FriendlyName: 'Ship Delay',
},
],
},
} as PredefinedConfig;

More Information