FreeGridv1.6.0한국어

API reference

createGrid(element, options) returns this API. Calls after destroy() do nothing.

createGrid(element, options) returns this API. Calls after destroy() do nothing.

MethodReturnsDescription
setData(rows, { scrollToTop? })voidReplace all rows. The scroll position stays unless scrollToTop is set.
getData()Row[]Current rows (unfiltered, unsorted).
setColumns(defs)voidReplace column definitions.
getColumnState() / applyColumnState(state)ColumnState[]Save and restore order, width, visibility and pinning.
resetColumnState()voidBack to the column definitions.
setColumnVisible(colId, visible)voidShow or hide a column.
autoSizeColumns(colIds?)voidFit widths to header and visible cells.
openColumnChooser() / closeColumnChooser()voidFloating column chooser.
toggleSideBar(open?)voidOpen or close the docked Columns panel.
setSort(items) / getSort()SortItem[]e.g. [{ colId: 'total', dir: 'desc' }].
setFilter(colId, model | null) / getFilterModel()FilterModelSet or clear one column filter.
setQuickFilter(text)voidSearch all visible columns.
getSelectedRows() / selectAll() / deselectAll()Row[]Selection helpers. selectAll selects the filtered rows.
setSummary(options | null) / getSummaryValues()object[]Change summary rows; read raw totals.
getRange() / setRange(range | null)GridRangeRead or set the active cell range.
getRanges() / setRanges(ranges)GridRange[]All ranges, including those added with Ctrl+click or Ctrl+drag; the last one is active.
copySelection({ headers? })stringCopy the range as Excel TSV and return it.
pasteText(text){ changed, skipped }Paste TSV/Excel text at the range or focused cell.
startEdit(rowIndex, colId) / stopEdit(cancel?)boolean / voidOpen or close the editor.
addRows(rows, index?) / removeRows(rows | fn) / removeSelectedRows()Row[]Insert or remove rows (tracked, undoable).
getModifiedRows() / getChanges() / hasChanges()objectCreated/updated/deleted rows and column-level diffs.
commitChanges() / revertChanges()voidAccept changes as the new baseline, or undo all of them.
undo() / redo() / canUndo() / canRedo()void / booleanUndo history for edits, pastes and row changes.
fillRange(target)voidFill from the selection into a larger range (series aware).
find(text) / findNext() / findPrevious() / clearFind()number / voidHighlight and step through matching cells.
setPinnedRows({ top?, bottom? })voidChange pinned rows.
setGroupBy(colIds) / getGroupBy()void / string[]Change or read the grouping.
expandAll() / collapseAll() / setGroupExpanded(key, open)voidOpen or close groups and tree rows. Group keys look like 'country:KR|city:Seoul'; tree keys are row ids.
setDetailExpanded(row, open) / isDetailExpanded(row)void / booleanOpen, close or check a detail panel.
dropRow(row, target, position?)booleanMove a row 'before', 'after' or (tree data) 'inside' another row; null target = to the end. False when refused.
moveRow(row, toIndex)booleanMove a row in the source data (undoable). False while sorting, filtering or grouping.
setPage(n) / getPage() / getPageCount()void / numberMove between pages (0-based).
setPageSize(n) / getPageSize()void / numberChange rows per page.
refreshRows()voidServer data: drop cached rows and load again.
exportXlsx(filename?, options?) / getXlsx(options?)void / Uint8ArrayExcel file of the rows. Options: columns, rows (filtered | all | selected), headers, sheetName, styles (column align and cellClass colors, default true).
exportCsv(filename?, options?) / getCsv(options?)void / stringCSV with a BOM so Excel reads Korean; same options plus separator.
exportJson(filename?, options?) / getJson(options?)void / stringThe rows as an array of objects keyed by column id (keys: 'header' for headers); formatted: true saves the text as shown.
exportPdf(filename?, options?) / getPdf(options?)void / Uint8Array | nullThe print layout as a PDF made in the browser (any script), with repeatHeader, repeatRows and repeatTitle.
importFile(file, { mode?, sheet? })Promise<{ rows, skipped }>Read .xlsx or CSV; headers are matched to columns; append (default) or replace.
toggleSideBar(open?, panel?)voidOpen or close the side bar, optionally on 'columns' or 'filters'.
setPivot(config | null) / getPivot()void / PivotConfig | nullTurn the pivot on, change it, or return to the normal view.
createChart({ type?, range?, container?, title? }){ el, setType, update, destroy }SVG chart of the range or the whole view: 'bar', 'stackedBar', 'line', 'area', 'pie'.
versionstringExported constant with the package version, e.g. import { version }.
getDisplayedRowCount()numberRows after filtering.
scrollToRow(index)voidScroll a displayed row into view.
getScrollPosition() / setScrollPosition({ top?, left? }){ top, left }Read or set the scroll offsets of the rows area in px.
syncScroll(otherGrid, axis?)() => voidScroll two grids together ('both', 'vertical' or 'horizontal'); returns a function that unlinks them.
validate(){ row, rowIndex, colId, message }[]Check every editable cell against required, unique and validate; empty when all rows are valid.
getState() / setState(state, { parts? })SavedGridStateThe whole view as plain JSON — columns, sort, filters, advanced filter, grouping, open groups, column groups, page, selection — to save per user and restore.
applyTransaction({ add?, addIndex?, update?, remove? }) / applyTransactionAsync(tx)TransactionResult / voidChange rows by id (live data). Not undoable, not tracked as edits; changed cells flash. The async version merges calls into one update about every 50 ms.
flushAsyncTransactions()voidApply the queued applyTransactionAsync updates now. A transaction may also have upsert: rows updated by id or added.
setConditionalFormats(list) / getConditionalFormats() / openConditionalFormats(colId)void / ConditionalFormat[] / voidReplace or read the conditional formats; open the dialog for a column.
askAssistant(prompt) / openAssistant()Promise<AssistantResult> / voidAsk the AI assistant from code (the result has message, applied, skipped and undo()), or open its chat panel.
setAdvancedFilter(filter | null) / getAdvancedFilter() / openFilterBuilder()void / AdvancedFilter | null / voidConditions across columns with nested and / or: { operator: 'or', conditions: [{ colId, model }, { operator: 'and', conditions: [...] }] }.
cutSelection()stringCopy the range, then clear its editable cells (one undo step). Also Ctrl+X.
stopRowEdit(cancel?)voideditType 'row': finish the row being edited.
setColumnGroupOpened(groupId, open) / isColumnGroupOpened(groupId)void / booleanOpen or close a collapsible column group.
print(options?) / getPrintHtml(options?)void / stringPrint the rows as a table: group and summary rows, page numbers. Options: the export options plus title, subtitle, footer, paper, orientation, fitToWidth, groups, summary, striped, pageNumbers, printedAt, rowNumbers.
getXlsxSheet(options?)XlsxSheetOne worksheet of the rows, for buildWorkbook / exportWorkbook.
setDensity(density) / getDensity()void / string'compact', 'normal' or 'comfortable'.
showOverlay(kind | null)voidShow the 'loading' or 'noRows' overlay yourself; null goes back to automatic.
restDatasource(url, options?) · loadData(grid, url, options?) · saveChanges(grid, url, options?) · csrfHeaders()module functionsServer helpers (Spring Boot, eGovFrame…): a datasource over POST JSON, "search, edit, save" screens, and the Spring Security CSRF header. See Server integration.
buildWorkbook(sheets) / exportWorkbook(filename, sheets)module functionsOne .xlsx with a sheet per grid: [{ grid, sheetName, options }].
setTheme(name)voidSwitch theme.
setFont({ size?, family? })voidChange font; family null restores the theme font.
setLocale(codeOrPack)voidSwitch UI language.
on(event, handler)() => voidSubscribe; returns an unsubscribe function.
destroy()voidRemove the grid and its listeners.