gridcn2.0.0
Cheatsheets and messages

Hooks A to Z

Find a gridcn hook by name, see what it returns or does, and open the page that explains it.

Each table lists the hooks of one source. Every row links to the page that explains the hook.

Store hooks

Call these hooks inside a DataGridProvider. useDataGridStoreProps runs outside it and creates the store. createDataGridSelector builds such a hook. Import them from @/components/data-grid/data-grid.

HookPurposePage
createDataGridHooksReturns useDataGridApi, useDataGridRow, the column hooks, and useDataGridSelector typed for one row type.Store hooks
createDataGridSelectorBuilds a typed hook that reads any slice of the store.Store hooks
useDataGridActionsReturns the stable actions object.Store hooks
useDataGridActiveCellReturns the active cell as a ViewCoord.Store hooks
useDataGridActiveColumnReturns the view column of the active cell.Store hooks
useDataGridAllColumnsReturns every column, hidden ones included.Store hooks
useDataGridApiReturns the imperative handle.Store hooks
useDataGridCellEditingErrorReturns the live validation error of the cell in edit.Store hooks
useDataGridCellErrorsReturns the map of server errors.Store hooks
useDataGridCellStateReturns the state of one cell.Store hooks
useDataGridCellTypesReturns the resolved cell type registry.Store hooks
useDataGridClipboardReturns copy, cut, and pasteFromClipboard.Store hooks
useDataGridColumnWidthReturns the width override of a column.Store hooks
useDataGridColumnWidthsReturns the width overrides of a list of columns.Store hooks
useDataGridEditingReturns the edit in progress.Store hooks
useDataGridFilterStateReturns the filter tree.Store hooks
useDataGridGatePendingReturns the set of gate names whose promise has not settled.Gate cancellation and timeouts
useDataGridGetSelectionValuesReturns a callback that reads the values of the main range.Store hooks
useDataGridHiddenCheckedCountReturns the count of checked rows that left the view.Store hooks
useDataGridIsColumnHiddenReturns whether a column is hidden.Store hooks
useDataGridKeymapReturns the effective keymap without bindings that never match.Store hooks
useDataGridLabelsReturns the merged labels.Store hooks
useDataGridLiveAnnouncementReturns the current live region announcement, or null.Live region messages
useDataGridPendingSaveCountReturns the count of pending saves.Store hooks
useDataGridReadOnlyReturns the readOnly flag.Store hooks
useDataGridRowReturns the row at a view index.Store hooks
useDataGridRowCellStateReturns the state of the cells of one row.Store hooks
useDataGridRowIdReturns the row id at a view index.Store hooks
useDataGridRowIdsReturns the row ids for a list of view indexes.Store hooks
useDataGridRowIdToViewRowReturns a map from row id to view index.Store hooks
useDataGridRowSaveStatusReturns the save status of a row.Store hooks
useDataGridScrollToCellReturns a function that scrolls to a CellRef.Store hooks
useDataGridScrollToCellAtReturns a function that scrolls to a ViewCoord.Store hooks
useDataGridSearchTextReturns the quick-search text.Store hooks
useDataGridSelectedRowsReturns the checked rows for a bulk action.Store hooks
useDataGridSelectionReturns the selection in view indexes.Store hooks
useDataGridSortStateReturns the active sorts.Store hooks
useDataGridStorePropsCreates the store outside the provider.Store hooks
useDataGridViewIndexReturns the view index array.Store hooks
useDataGridViewStaleReturns whether rows keep an old view index.Store hooks
useDataGridVisibleColumnsReturns the visible columns.Store hooks
useShortcutLabelReturns the key labels of a binding: word names during server rendering, glyphs on macOS after hydration.Shortcut remapping

SDK exports

Import them from @/components/data-grid/data-grid-sdk.

ExportPurposePage
sortCollatorReturns the collator of locale, or of the sortLocale in scope when locale is omitted, or the "en-US" collator outside a scope. A custom text compare calls it synchronously.CellType contract
useDataGridStoreApiReturns the read-only store view for exportGrid and the import helpers.Export options
useOptionalDataGridLabelsReturns the labels of the enclosing DataGridProvider, or null outside one.Store hooks
withSortLocaleRuns a synchronous function with a sortLocale in scope. A function that returns a promise leaves the scope at its first await, with one development warning. Wrap a sort or text compare that runs outside the view build.Sorting

Cell editor hooks

HookPurposePage
useCellEditorGives a text editor its draft state and key bindings.CellType contract
useCommitGuardGuards a one-shot commit against Enter then blur.CellType contract
useSeedFocusFocuses an editor input with the caret at the end.CellType contract

Add-on hooks and factories

Import an add-on hook from the barrel of its item, such as @/components/data-grid-history/data-grid-history. The Source column names the item.

HookSourcePurposePage
aggregateRowdata-grid-pinned-rowsDeclares a totals row for useDataGridPinnedRows.Pinned rows options
serverAggregateRowdata-grid-pinned-rowsDeclares a totals row that your server computes.Pinned rows options
useDataGridAggregatedata-grid-pinned-rowsReads an aggregate inside the provider.Pinned rows options
useDataGridCommentsdata-grid-commentsAdds comments to cells, with a marker and a popover.Add comments to cells
useDataGridExportdata-grid-ioExports the grid to a file.Export options
useDataGridFilldata-grid-fillMounts the fill handle plugin.Fill handle
useDataGridFindReplacedata-grid-find-replaceMounts find and replace.Find and replace
useDataGridHistorydata-grid-historyMounts undo and redo on a state you own.Undo and redo
useDataGridImportPreviewdata-grid-ioParses a file into a preview.Import options
useDataGridKeybindingsdata-grid-keybindingsMounts the dialog that lists the effective keymap.Shortcut remapping
useDataGridPagerdata-grid-paginationReturns the pager of the provider.Client pagination
useDataGridPaginationdata-grid-paginationReturns pageData and the pager for a list outside the grid.Client pagination
useDataGridPinnedRowsdata-grid-pinned-rowsMounts pinned rows.Pinned rows
useDataGridPresencedata-grid-presenceShows the cells that other users select.Show presence
useDataGridPresenceHighlightsdata-grid-presenceReturns the current highlights from the storeApi of useDataGridPresence.Presence options
useDataGridPrintdata-grid-ioPrints the grid.Export options
useDataGridRowOpsdata-grid-context-menuReturns canCreateRow and canDuplicateRow.Context menu options
useDataGridSelectionStatsdata-grid-status-barReturns statistics of the selection.Status bar
useDataGridServerAggregatedata-grid-pinned-rowsReturns the totals of a server result.Show totals from a server
useDataGridServerPagerdata-grid-paginationBuilds the pager for rows you fetch yourself.Load rows by page
useDataGridServerRowsdata-grid-serverFetches rows from your backend.Server rows options
useDataGridStatedata-grid-historyHolds the data and the history together.Undo and redo
useDataGridUrlPaginationdata-grid-url-stateKeeps page and pageSize in the URL.Keep pages in URL
useDataGridUrlStatedata-grid-url-stateKeeps the sort, filter, and search in the URL.URL state
useDataGridViewsdata-grid-viewsSaves, applies, and manages named views.Saved views
useStashedPagerdata-grid-paginationReturns the pager that a server hook stashed on the grid.Find and replace options

Utility hooks

HookPurposePage
useDebounceDelays a value until it stops changing.useDebounce
useDebouncedInputDebounces the commit of a text input.useDebouncedInput

On this page