API REFERENCE
ColumnDef
Fields, allowed values, and APIs that use ColumnDef.
Type definition
A question mark (?) marks an optional field; readonly marks a value you should not change directly. A union (|) accepts one of the listed forms. Functions are callbacks that Grid invokes at the relevant point.
export interface ColumnDef<TData = GridData, TValue = unknown, TContext = unknown> {
field: GridFieldPath<TData>;
colId?: string;
headerName?: string;
headerTooltip?: string;
sortable?: boolean;
sort?: 'asc' | 'desc' | null;
sortIndex?: number;
filter?:
| ColumnFilterDecl
| string
| GridFilterDefinition<TData, TValue, unknown, TContext>;
valueGetter?: GridCallback<[ValueGetterParams<TData, TValue, TContext>], TValue> | string;
formula?: string;
valueFormatter?: GridCallback<[ValueFormatterParams<TData, TValue, TContext>], string> | string;
tooltipField?: GridFieldPath<TData>;
tooltipValueGetter?: GridCallback<[ValueGetterParams<TData, TValue, TContext>], unknown> | string;
cellRenderer?:
| string
| CellRenderer<TData, TValue>
| GridRendererDefinition<TData, TValue, TContext>;
cellRendererMeta?: Record<string, unknown>;
cellEditor?: GridCellEditorDeclaration<TData, TValue, TContext>;
floatingFilterComponent?:
| string
| GridFloatingFilterDefinition<unknown, TContext>;
cellClass?:
| string
| string[]
| GridCallback<[CellCallbackParams<TData, TValue, TContext>], string>;
cellClassRules?: Record<
string,
GridCallback<[CellCallbackParams<TData, TValue, TContext>], boolean> | string
>;
cellStyle?:
| Record<string, string | number>
| GridCallback<
[CellCallbackParams<TData, TValue, TContext>],
Record<string, string | number> | null | undefined
>
| ReadonlyArray<
| Record<string, string | number>
| GridCallback<
[CellCallbackParams<TData, TValue, TContext>],
Record<string, string | number> | null | undefined
>
>;
width?: number;
minWidth?: number;
maxWidth?: number;
flex?: number;
resizable?: boolean;
reorderable?: boolean;
pinned?: 'left' | 'right' | null;
columnGroupShow?: 'open' | 'closed';
aggFunc?: 'sum' | 'avg' | 'min' | 'max' | 'count' | string;
hidden?: boolean;
hide?: boolean;
editable?: boolean;
editor?: 'text' | 'number' | 'date' | 'select' | 'checkbox' | 'textarea' | 'autocomplete' | 'largeText';
valueParser?: GridCallback<[ValueParserParams<TData, TValue, TContext>], TValue>;
valueSetter?: GridCallback<
[ValueSetterParams<TData, TValue, TContext>],
boolean | void
>;
comparator?: GridCallback<[TValue, TValue, Readonly<TData>, Readonly<TData>], number>;
options?: ReadonlyArray<{ value: unknown; label: string; disabled?: boolean }>;
min?: number | Date | string;
max?: number | Date | string;
step?: number;
decimals?: number;
nullable?: boolean;
allowEmpty?: boolean;
storeAs?: 'date' | 'iso';
rows?: number;
maxRows?: number;
cols?: number;
maxLength?: number;
rowDrag?: boolean;
wrapText?: boolean;
autoHeight?: boolean;
rowSpan?: (params: SyGridRowSpanParams<TData>) => number;
colSpan?: (params: SyGridColSpanParams<TData>) => number;
}APIs using this type
- columnDefs
Defines column data fields, headings, sizes, visibility, and editing. Include column groups to create multi-level headers.
- defaultColDef
Defaults shared by all columns. Override individual values in columnDefs for specific columns.