FreeGridv1.6.0한국어

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.
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.
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.
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.
editor{ type: 'select', options } | { type: 'textarea' | 'time' | 'datetime' } | (params) => editorEditor for this column. options can be a function of the row (dependent selects); an option with disabled: true cannot be chosen or pasted. 'datetime' is the default for date columns with format 'datetime'.
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.