Each entry in the [columns] array is a GridColumn<T> object, where T is the row data type. Only key is required — every other property has a safe default or is simply omitted when not needed.
Unique column identifier. Used as the sort key, filter key, and column persistence key. Must be unique within the columns array.
name
string
—
Header display label. Defaults to an empty string when omitted.
prop
keyof T | string
—
Data path to read the cell value from the row object. Supports dot-notation for nested properties, e.g. 'address.city'. Omit when using valueGetter or a custom cellTemplate that reads the row directly.
valueGetter
(row: T, col: GridColumn<T>) => any
—
Custom value resolver. Takes precedence over prop when both are set. Also used when exporting this column.
Sizing
Property
Type
Default
Description
sizing
'fixed' | 'flex' | 'auto'
'fixed'
Column sizing mode. 'fixed' — exact px width, no growth. 'flex' — grows proportionally via flexGrow. 'auto' — fills remaining space equally with other auto columns.
width
number
—
Column width in px. Used when sizing is 'fixed'.
minWidth
number
—
Minimum width in px. Enforced during drag-resize and respected by flex sizing. Defaults to 50 during resize operations.
maxWidth
number
—
Maximum width in px. Enforced during drag-resize.
flexGrow
number
1
Flex-grow factor. Only used when sizing is 'flex'. A column with flexGrow: 2 claims twice as much space as one with flexGrow: 1.
resizable
boolean
false
Show a drag resize handle on this column's header cell. config.columnResize must also be true.
Positioning
Property
Type
Default
Description
pin
'left' | 'right'
—
Pin (stick) the column to the left or right edge. Pinned columns remain visible during horizontal scroll. Multiple left-pinned columns stack automatically with correct sticky offsets.
draggable
boolean
false
Enable drag-drop reorder for this column. config.columnReorder must also be true.
order
number
—
Initial render position. Lower values appear first. Overridden by persisted column state when config.persistColumns is set.
Sorting
Property
Type
Default
Description
sortable
boolean
false
Enable click-to-sort on this column's header cell.
sortKey
string
key
The key sent in SortConfig.key when this column is sorted. Useful when the server expects a different field name than col.key.
comparator
(a, b, rowA, rowB, dir) => number
—
Custom client-side sort comparator. Receives both the resolved cell values and the full row objects. Return negative / zero / positive.
Visibility
Property
Type
Default
Description
hidden
boolean
false
Start the column hidden. Free to set, and reversible at any time through setState({ columns }).
Templates
Assign Angular TemplateRef instances (obtained via @ViewChild in the host component) to fully customise rendering for headers, cells, and summary rows. Each template receives a typed context object — see the context types section below.
Property
Type
Context
Description
cellTemplate
TemplateRef
CellContext<T>
Custom body cell renderer. Replaces the default text rendering for every data row in this column.
headerTemplate
TemplateRef
HeaderContext<T>
Custom header cell renderer. Replaces the default label and sort icons.
subHeaderTemplate
TemplateRef
SummaryContext<T>
Renders a summary row between the header and the first data row. Suitable for column sub-headings or aggregate values.
footerTemplate
TemplateRef
SummaryContext<T>
Renders a summary row pinned below the last data row. Suitable for column totals or grand totals.
// In your component class:@ViewChild('salaryCell') salaryCell!: TemplateRef<CellContext<Employee>>;@ViewChild('statusHeader') statusHeader!: TemplateRef<HeaderContext<Employee>>;@ViewChild('salaryFooter') salaryFooter!: TemplateRef<SummaryContext<Employee>>;// Wrap in computed() so ViewChild refs are available at render timereadonly columns =computed((): GridColumn<Employee>[]=>[{
key:'salary',
name:'Salary',
prop:'salary',
width:130,
cellTemplate:this.salaryCell,
footerTemplate:this.salaryFooter,},{
key:'status',
name:'Status',
width:100,
headerTemplate:this.statusHeader,},]);// In the component template:// <ng-template #salaryCell let-value="value">// {{ value | currency:'USD':'symbol':'1.0-0' }}// </ng-template>//// <ng-template #salaryFooter let-column="column">// Total: {{ total() | currency }}// </ng-template>//// <ng-template #statusHeader let-column="column" let-sortDir="sortDir">// {{ column.name }}// @if (sortDir === 'asc') { ↑ } @else if (sortDir === 'desc') { ↓ }// </ng-template>
Extra CSS class(es) applied to every body cell in this column. The function form receives the row object and resolved cell value per row.
headerClass
string
—
Extra CSS class applied to the header cell for this column.
Filtering
Property
Type
Default
Description
filter
ColumnFilterConfig
—
Enable a filter control for this column. config.filterMode must also be set. Omit to show no filter control for this column.
ColumnFilterConfig properties
Property
Type
Default
Description
type
'text' | 'number' | 'date' | 'select' | 'set'
REQUIRED
Determines the input control and default operators shown in the filter.
placeholder
string
—
Input placeholder text shown when the filter is empty.
operators
FilterOperator[]
type defaults
Override the list of available filter operators shown in the operator dropdown.
options
{ label: string; value: any }[]
—
Required when type is 'select'. Optional for 'set' — if omitted, unique values are extracted from loaded rows automatically.
fetchValues
() => Observable<{ label: string; value: any }[]>
—
Used with type: 'set' only. Load the checklist values from the server on demand rather than extracting them from client-side rows.
Filter types:'text' — string operators (contains, equals, starts with, ends with, not contains). 'number' — numeric operators (=, ≠, >, ≥, <, ≤). 'date' — date operators (equals, before, after). 'select' — single-value dropdown from a static options list. 'set' — multi-value checklist (operator: in). Values can be static, extracted from rows, or fetched via fetchValues.
Inline editing
Set editable: true on a column to enable in-place cell editing. The interaction that triggers the editor is controlled by config.editTrigger (double-click by default). Committed edits emit (cellEditCommit) and are automatically added to the grid's undo/redo history (Ctrl+Z / Ctrl+Y).
Property
Type
Default
Description
editable
boolean | (row: T) => boolean
false
Enable inline editing for this column. Pass a function to make individual rows read-only (e.g. lock the header row in an editable spreadsheet).
Editor control type. Built-in controls auto-focus and commit on Enter/Tab. Pass a TemplateRef<EditorContext<T>> for a fully custom editor component.
editorOptions
{ placeholder?, min?, max?, step?, options? }
—
Control-specific options. placeholder applies to text/number. min / max / step apply to number. options: { label, value }[] is required when editor: 'select'.
valueSetter
(row: T, value: any) => T
—
Custom function to apply the new value to the row object. Must return the updated row (immutably). When omitted the grid does a shallow spread: { ...row, [prop]: value }. Use a valueSetter when the column uses a valueGetter or nested prop.
Grouping aggregation
When config.grouping is active, columns can display per-group aggregate values inside the group header row.
Aggregation shown inside each group header for this column. Built-in names resolve numerically (non-numeric values are ignored for sum/avg/min/max). Pass a custom function for any other calculation.
aggregationFormat
(value: any) => string
—
Optional formatter applied to the aggregation result before display (e.g. v => '$' + v.toLocaleString()).
Export
Property
Type
Default
Description
excludeFromExport
boolean
false
Set to true to omit this column from all CSV, Excel, and Word exports. Also omits it when exporting via the context menu.
Template context types
import{
CellContext,
HeaderContext,
SummaryContext,
ExpandContext,}from'@gridcraft/angular';// ── cellTemplate ─────────────────────────────────────────────// Provides the full row and the resolved cell value.interfaceCellContext<T=any>{
$implicit:T;// the row object — use "let-row" shorthand
row:T;
value:any;// resolved via valueGetter → prop path → undefined
column: GridColumn<T>;
rowIndex:number;}// ── headerTemplate ────────────────────────────────────────────// Provides the column definition and the active sort direction.interfaceHeaderContext<T=any>{
column: GridColumn<T>;
sortDir:'asc'|'desc'|null;}// ── subHeaderTemplate / footerTemplate ───────────────────────// Provides only the column definition (no row data — these are summary rows).interfaceSummaryContext<T=any>{
column: GridColumn<T>;}// ── #gcExpandRow template (on <gridcraft>, not a column) ──// Provides the parent row whose expand panel is being rendered.interfaceExpandContext<T=any>{
$implicit:T;// the row object — use "let-row" shorthand
row:T;
rowIndex:number;}