API Reference

May 11, 2026 · View on GitHub

Complete reference for GridOptions, GridColumnDef, and the UiGridApi runtime surface.

All types are exported from @ornery/ui-grid-core. The Angular package (@ornery/ui-grid) re-exports them for convenience.

Vanilla Custom Element Surface

The vanilla web component (@ornery/ui-grid-vanilla) supports three equivalent configuration styles for the subset of GridOptions that can be expressed without functions:

Declarative attributes

<ui-grid-element
  grid-id="accounts"
  title="Accounts"
  enable-sorting
  enable-filtering
  row-height="44"
  column-defs='[{"name":"name"},{"name":"status"}]'
  data='[{"name":"Acme","status":"Active"}]'
>
</ui-grid-element>

Individual JS properties

const grid = document.querySelector('ui-grid-element');
grid.gridId = 'accounts';
grid.title = 'Accounts';
grid.enableSorting = true;
grid.enableFiltering = true;
grid.rowHeight = 44;
grid.columnDefs = [{ name: 'name' }, { name: 'status' }];
grid.data = [{ name: 'Acme', status: 'Active' }];

Full options object

grid.options = {
  id: 'accounts',
  data: [{ name: 'Acme', status: 'Active' }],
  columnDefs: [{ name: 'name' }, { name: 'status' }],
  enableSorting: true,
  enableFiltering: true,
  onRegisterApi: (api) => {
    window.gridApi = api;
  },
};

Use attributes or individual properties for static configuration. Use options for callbacks like onRegisterApi, function-valued column definitions such as valueGetter, sortingAlgorithm, and cellRenderer, or when you prefer a single bulk assignment.

The vanilla merge order is:

{ ...attributeOptions, ...jsPropertyOptions }

That means explicit JS property values win over declarative attributes when both are present.

GridOptions

FieldTypeDefaultDescription
idstringrequiredUnique grid identifier
datareadonly GridRecord[]requiredRow data array
columnDefsreadonly GridColumnDef[]requiredColumn definitions
titlestringGrid heading text
rowHeightnumber44Row height in pixels
headerRowHeightnumberHeader row height override
emptyMessagestringMessage when no rows match
labelsPartial<GridLabels>en-USi18n string overrides
enableSortingbooleantrueEnable column sorting
enableFilteringbooleantrueEnable filter row
enableGroupingbooleanfalseEnable row grouping
grouping{ groupBy?: string[]; startCollapsed?: boolean }Grouping configuration
enableColumnMovingbooleanfalseEnable drag-and-drop column reorder
enablePinningbooleanEnable column pinning (freeze left/right)
enableVirtualizationbooleanautovirtual scroll (auto at 40+ rows)
virtualizationThresholdnumber40Row count that triggers virtualization
enablePaginationbooleanfalseEnable pagination
enablePaginationControlsbooleantrueShow pagination UI
useExternalPaginationbooleanfalseGrid skips local slicing
paginationPageSizenumberRows per page
paginationPageSizesnumber[] | nullPage size selector options
paginationCurrentPagenumberInitial page
totalItemsnumberTotal for external pagination
enableExpandablebooleanfalseEnable expandable detail rows
expandableRowHeightnumber150Detail row height
expandableRowHeaderWidthnumberWidth of the expand toggle column
expandableRowTemplateTemplateRefAngular template for detail content
expandableRowScopeRecord<string, unknown>Extra template context variables
enableTreeViewbooleanfalseEnable hierarchical tree display
treeChildrenFieldstring'children'Property name for child rows
treeIndentnumber10Pixels per indent level
showTreeExpandNoChildrenbooleantrueShow toggle for childless rows
treeRowHeaderAlwaysVisiblebooleanfalseAlways show expand column
enableCellEditbooleanfalseEnable inline cell editing
enableCellEditOnFocusbooleanfalseEnter edit mode on cell focus
cellEditableConditionboolean | (ctx) => booleanGrid-level edit guard
enableAutoResizebooleanfalseResizeObserver-driven viewport height
infiniteScrollRowsFromEndnumberThreshold rows from end to trigger load
infiniteScrollUpbooleanEnable upward infinite scroll
infiniteScrollDownbooleanEnable downward infinite scroll
rowIdentity(row, i) => stringCustom row ID function
benchmark{ iterations?: number }Render benchmark configuration
onRegisterApi(api) => voidCallback to receive the UiGridApi instance

GridColumnDef

FieldTypeDescription
namestringColumn identifier (also the default data key)
displayNamestringHeader label (auto-titleized from name if absent)
fieldstringDot-path into data record (e.g. 'address.city')
type'string' | 'number' | 'boolean' | 'date' | 'object'Data type hint for sorting and editing
widthstringCSS grid track value (e.g. '200px', 'minmax(10rem, 1fr)')
align'start' | 'center' | 'end'Cell text alignment
visiblebooleanHide column when false
sortablebooleanColumn-level sort override
enableSortingbooleanAlias for sortable
filterablebooleanColumn-level filter override
enableFilteringbooleanAlias for filterable
enableGroupingbooleanAllow grouping by this column
enablePinningbooleanAllow pinning this column
pinnedLeftbooleanPin this column to the left on init
pinnedRightbooleanPin this column to the right on init
enableCellEditbooleanColumn-level edit override
enableCellEditOnFocusbooleanEdit starts on focus for this column
cellEditableConditionboolean | (ctx) => booleanColumn-level edit guard
editModelFieldstringDot-path for writing edited values
sort{ direction?: SortDirection; priority?: number; ignoreSort?: boolean }Initial sort configuration
filter{ term?: unknown; condition?: FilterCondition | RegExp | Function; flags?: { caseSensitive?: boolean; date?: boolean }; rawTerm?: boolean; noTerm?: boolean }Filter configuration
sortingAlgorithm(a, b) => numberCustom sort comparator
formatter(value, row) => stringDisplay value formatter
valueGetter(row) => unknownCustom value extractor
cellTemplateTemplateRefAngular template for cell content
cellRenderer(ctx) => stringHTML string cell renderer

UiGridApi

Access the API via onRegisterApi. The API is organized into namespaces.

core

MethodDescription
refresh()Force a full pipeline re-run
queueGridRefresh()Alias for refresh()
queueRefresh()Alias for refresh()
refreshRows()Alias for refresh()
getVisibleRows()Get currently visible GridRow objects
sortColumn(name, direction?)Programmatic sort
setFilter(name, value)Set a column filter
clearAllFilters()Clear all active filters
groupByColumn(name)Add/remove a column from grouping
clearGrouping()Remove all grouping
moveColumn(from, to)Reorder columns by index
exportCsv()Download visible rows as CSV
benchmark(iterations?)Run render benchmark
setRowInvisible(row, reason?)Hide a row programmatically
clearRowInvisible(row, reason?)Un-hide a row

core.on (Events)

EventCallback Signature
renderingComplete(api) => void
sortChanged(columnName, direction) => void
filterChanged(filters) => void
groupingChanged(groupBy) => void
columnOrderChanged(order) => void
rowsVisibleChanged(rows) => void
rowsRendered(rows) => void
scrollBegin / scrollEnd() => void
canvasHeightChanged(oldHeight, newHeight) => void
gridDimensionChanged(oldH, oldW, newH, newW) => void
benchmarkComplete(result) => void

pagination

MethodDescription
nextPage() / previousPage()Navigate pages
seek(page)Jump to a specific page
setPageSize(n)Change rows per page
getPage() / getTotalPages()Current page info
getFirstRowIndex() / getLastRowIndex()Row index range
on.paginationChanged(page, pageSize) => void

expandable

MethodDescription
toggleRowExpansion(row)Toggle a single row
expandAllRows() / collapseAllRows()Bulk expand/collapse
toggleAllRows()Toggle all rows
on.rowExpandedStateChanged(row, expanded) => void

treeBase

MethodDescription
toggleRowTreeState(row)Toggle tree node expansion
expandRow(row) / collapseRow(row)Explicit expand/collapse
expandAllRows() / collapseAllRows()Bulk operations
getRowChildren(row)Get child GridRow objects
on.rowExpanded / on.rowCollapsed(row) => void

treeView

MethodDescription
getTreeView()Get current tree expansion state
setTreeView(state)Bulk set expansion state

pinning

MethodDescription
pinColumn(name, direction)Pin a column left, right, or unpin ('none')
on.columnPinned(columnName, direction) => void

infiniteScroll

MethodDescription
dataLoaded(scrollUp?, scrollDown?)Signal that new data is loaded
resetScroll(scrollUp?, scrollDown?)Reset to fresh state
saveScrollPercentage()Persist scroll position ratio
setScrollDirections(up, down)Toggle scroll directions
dataRemovedTop(scrollUp?, scrollDown?)Signal rows removed from top
dataRemovedBottom(scrollUp?, scrollDown?)Signal rows removed from bottom
on.needLoadMoreData() => void
on.needLoadMoreDataTop() => void

edit

Method / EventDescription
beginCellEdit(row, col, event?)Start editing a cell
endCellEdit()Commit the current edit
cancelCellEdit()Cancel without committing
getEditingCell()Returns current editing position or null
on.beginCellEdit(row, col, event) => void
on.afterCellEdit(row, col, newVal, oldVal) => void
on.cancelCellEdit(row, col) => void

saveState

MethodDescription
save()Returns a serializable GridSavedState
restore(state)Applies a previously saved state