Calculated Column Config
The Predefined Configuration for the Calculated Column function.
Contains a single Calculated Columns array.
Calculated Column State
Property | Description | Default |
---|---|---|
CalculatedColumns | Collection of Calculated Columns | empty |
Calculated Column Object
Property | Description |
---|---|
CalculatedColumnSettings | Addtional optional properties for Column (e.g. filterable, resizable) |
ColumnExpression | Expression which AdapTable parser uses to evaluate Column' display value |
ColumnId | Name of Calculated Column |
FriendlyName | Name to be used in Column Header; if blank ColumnId is used |
Calculated Column Settings
Property | Description | Default |
---|---|---|
Aggregatable | Whether Column can be used in an aggregation when grouping | true |
DataType | Expression's return value DataType; inferred by AdapTable but setable by User | |
Filterable | Whether Column is filterable | true |
Groupable | Whether Column can be grouped | true |
Pivotable | Whether Column can be used when grid is in pivot mode | true |
Resizable | Whether Column can be resized (by dragging column header edges) | true |
ShowToolTip | Show underlying Expression as ToolTip when hovering over a cell | false |
Sortable | Whether Column is sortable | true |
Width | Preferred 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;