FreeGridv1.15.1한국어

Column definitions

Columns are plain objects. The column id is id if you set one, otherwise field; sorting, filters and column state all refer to columns by that id.

Columns are plain objects. The column id is id if you set one, otherwise field; sorting, filters and column state all refer to columns by that id.

const columns = [
  { field: 'id', header: 'ID', type: 'number', format: '0', width: 80, pinned: 'left' },
  { field: 'name', header: 'Name', flex: 1, minWidth: 160 },
  { field: 'price', header: 'Price', type: 'number', format: 'currency:KRW' },
  { field: 'qty', header: 'Qty', type: 'number' },
  // computed column
  { id: 'amount', header: 'Amount', type: 'number', format: '#,##0', valueGetter: row => row.price * row.qty },
  { field: 'status', header: 'Status', filter: 'set', cellClass: p => `status-${p.value}` },
];
NameTypeDescription
fieldstringProperty of the row object shown in this column; 'address.city' reads and writes nested objects.
idstringColumn id. Defaults to field; required when there is no field.
headerstringHeader text. Defaults to field.
type'text' | 'number' | 'date' | 'boolean'Drives alignment, formatting, sorting and the default filter.
formatstring | Intl optionsNumber: '#,##0.00', '0.0%', 'currency:KRW', 'integer'. Date: 'date', 'datetime', 'time', 'short', 'medium', 'long'.
width / minWidth / maxWidthnumberPixel widths. Default width 120, min 40.
flexnumberShare of the leftover width. Resizing turns it into a fixed width.
pinned'left' | 'right'Keep the column visible while scrolling horizontally.
hidebooleanStart hidden. Users can show it from the column chooser.
align'left' | 'center' | 'right'Cell alignment. Numbers default to right.
sortablebooleanDefault true.
resizablebooleanDefault true.
filter'text' | 'number' | 'date' | 'set' | falseFilter UI in the column menu. Default depends on type.
comparator(a, b, rowA, rowB) => numberCustom sort order.
valueFormatter({ value, formatted, row?, column }) => stringText of the value on screen, in quick search, find, tooltips, copy, CSV, print and PDF (Excel keeps numbers and dates). formatted is what format would show.
valueParser({ text, row, oldValue, column }) => unknownTyped or pasted text → the value to store; undefined refuses it. Rules still run.
autoSizebooleanfalse: the autoSizeColumns option leaves this column alone.
valueGetter(row) => unknownComputed value, e.g. quantity × price. Used for display, sort, filter and summaries.
renderer(params) => string | HTMLElementCustom cell content. Strings are inserted as HTML — escape untrusted data.
cellClassstring | (params) => stringExtra CSS class on cells. Its text color, background and bold also go into Excel exports.
wrapTextbooleanWrap long text onto more lines; with autoRowHeight the row grows to fit.
rowSpan / colSpan({ value, row, rowIndex }) => numberCells covering several rows or columns, decided per cell. rowSpan takes precedence over merge.
headerRenderer({ header, column }) => string | HTMLElementHeader content (icons, buttons, links); sorting and the menu button stay.
headerClassstring | (column) => stringExtra class names on the header cell (also for column groups).
copyableboolean | ({ value, row, column }) => booleanfalse keeps values out of copies: blocked cells copy as empty text.
tooltip / headerTooltipboolean | (params) => string / stringHover text: true shows the value, a function returns the text; headerTooltip explains the header. Cut-off text shows in full anyway (overflowTooltip).
columnGroupShow / openByDefault'open' | 'closed' / booleanCollapsible column groups: show a child only while its group is open or closed; the group header gets a toggle.
sparklinetrue | { type?: 'line' | 'bar' | 'area', color? }The value is an array of numbers drawn as a small chart in the cell.
childrenColumnDef[]Makes this a column group header.
mergeboolean | (a, b, rowA, rowB) => booleanMerge consecutive rows with the same value into one tall cell.
mergeAlign'top' | 'middle' | 'bottom'Where the text of a merged cell sits (default 'top'); it stays in the part of the block in view while scrolling.
wrapHeaderTextbooleanLet a long header label wrap.
aggFunc'sum' | 'avg' | 'min' | 'max' | 'count' | (values, rows) => valueAggregate shown in group rows.
chooserbooleanfalse keeps the column out of the column chooser.
lockVisiblebooleanUsers cannot hide this column.
editableboolean | ({ value, row, rowIndex, column }) => booleanAllow editing and pasting (needs field); a function decides per cell.
sortAbsolute / valuesAsboolean / 'percentOfTotal' | 'percentOfParent' | 'runningTotal'Sort numbers by size; show numbers as a share or a running total (screen only).
button{ label?, onClick(params), disabled?(params) }A button in every cell; the click does not select the row or start an edit.
link{ href?: string | (params) => string, target?, label?, onClick? }The value as a link; href is a function or a template like '/orders/{id}'.
image{ width?, height?, round?, alt? }The value is an image URL drawn as a thumbnail.
headerCheckboxbooleanBoolean and switch columns: a header checkbox that turns every shown editable cell on or off.
dependsOnstring[]Fields the options come from; a value no longer offered is cleared when one changes (same undo step).
editor{ type: 'select' | 'combo' | 'multiSelect' | 'radio', options } | { type: 'date' | 'dateRange', min?, max?, disabledDates? } | { type: 'toggle', on?, off? } | { type: 'number', min?, max?, step? } | { type: 'mask', mask, raw? } | { type: 'modal' | 'textarea' | 'time' | 'datetime' } | (params) => editorEditor for this column; see Editing › Editors. Date columns open a calendar by default, and format 'datetime' a date-time picker. options can be a function of the row (dependent selects); a combo function gets the typed text and may return a Promise. An option with disabled: true cannot be chosen or pasted. mask: 'phone', 'bizNo', 'card', 'zip' or a pattern like '000-0000-0000'.
singleClickEditbooleanOpen the editor with one click instead of a double-click.
requiredbooleanReject blank values.
validate(value, row) => true | stringReturn a message to reject a value.
uniquebooleanReject a value another row already has in this column (blank values are allowed).
formulasbooleanCells may hold formulas like '=qty*price' (same-row fields, + - * / % ^ &, ROUND, ABS, MIN, MAX, SUM, AVG, IF). The result is shown, sorted and exported; the editor keeps the formula.