Grid Data Technical Reference

View as Markdown

Grid API

GridApi

Grid data and selection.

Rows and cell values (raw, display and normalised), loading and editing data, filtering and sorting, the current selection, and row nodes. Prefer these methods to calling AG Grid directly when AdapTable wraps the behaviour.

Adds a Column Definition to the Grid

addGridData(dataRows, config)
returns

Promise<IRowNode[]>

Adds rows to AdapTable (and AG Grid)

addOrUpdateGridData(dataRows, config)
returns

Promise<{ addedRows: IRowNode[]; updatedRows: IRowNode[]; }>

Adds or Updates AdapTable (and AG Grid) with new and changed rows

applyFiltering()
returns

void

Applies current Filtering in AdapTable

Removes Column Sorts in AdapTable

clearFiltering()
returns

void

Removes all current Filters in AdapTable

Clears Row Grouping in the Grid

Closes the transposed view of the Grid (if open)

Collapse all open groups in Row Grouping

deleteGridData(dataRows, config)
returns

Promise<IRowNode[]>

Deletes rows from AdapTable (and AG Grid)

deselectAll()
returns

void

Deselects all selected rows, cells and ranges

Deselects the AG Grid Row Node in AdapTable

AG Grid Row Nodes in AdapTable

Deselects Row with given Primary Key Value

Deselects Row with given Primary Key Values

Expands all closed groups in Row Grouping

Expands Row Groups that contain given keys

getAgGridRowModelType()
returns

RowModelType

Returns AG Grid Row Model Type

getAllAgGridColumns()
returns

Column<any>[]

Return all AG Grid columns

getAllRowNodes(config)
returns

IRowNode[]

Retrieves all Row Nodes currently in the Grid (by default excluding the group rows)

Retrieves Display Value for a given cell

Retrieves Normalised Value for a given cell

Retrieves Raw Value for a given cell

Gets the count of the cells in a Column that have the given Raw Value

Returns summary info on Selected Cells

getColumnCount()
returns

number

Number of columns in the grid, including hidden columns.

Retrieves all the values for a single Column.

Retrieves ColumnSort for a given Column

Returns Column Sort information in AdapTable

getDisplayedData()
returns

any[]

Retrieves the displayed (formatted but not styled) data from the grid (filtered and sorted and visible columns only)

Retrieves Formatted Value for a given Raw Value in given Column

Retrieves Display Value for Cell in given Row and Column

Retrieves the distinct raw values currently in a Column, sorted.

Useful when building dropdown options (e.g. Action Column select, Forms)
from values that already exist in the Grid.

Returns an empty array if the Column is unknown.

Retrieves the filtered values for a single Column.

getFilteredData()
returns

any[]

Retrieves filtered data from the grid

getFirstDisplayedRowNode()
returns

IRowNode | undefined

Retrieves the first Displayed Row Node in AdapTable

getFirstRowNode()
returns

IRowNode | undefined

Retrieves the first Row Node in AdapTable

Retrieves Cell in given Row and Column

Returns all the Grid Cells in a Column that have the given Display Value

Returns all the Grid Cells in a Column that have the given Raw Value

getGridContainerElement()
returns

HTMLElement | null

Returns the Grid Container in which the AdapTable Instance is present

getGridData()
returns

any[]

Retrieves all data from the grid

getGroupRowNodes(config)
returns

IRowNode[]

Retrieves all Grouped Row Nodes currently in the Grid

getInternalState()
returns

InternalState

Returns the Internal section from AdapTable State

Retrieves Normalised Value for Cell in given Row and Column

Returns the Primary Key Value for a given Row Node

Returns the Primary Key Values for a given Row Node collection

Retrieves Raw Value for Cell in given Row and Column

getRowCount()
returns

number

Number of data rows, excluding group rows.

getRowNodeForIndex(rowIndex)
returns

IRowNode | undefined

Retrieves the displayed RowNode at the given index

Retrieves Row Node that contains given Primary Key

Retrieves Row Nodes that contain given Primary Keys

Returns all current Selected Cells in AdapTable

Returns all current Selected Rows in AdapTable

getVariant()
returns

AdaptableVariant

Returns current AdapTable Variant: vanilla, angular, react, vue

Number of columns that are currently visible.

Retrieves the visible (filtered and sorted) values for a single Column.

getVisibleData()
returns

any[]

Retrieves visible data from the grid (filtered and sorted from visible columns only)

Number of rows currently displayed, after filtering.

Retrieves all filtered Row Nodes currently in the Grid (i.e. after applying the current filter)

Highlights a Cell in AdapTable

Highlights a Column in AdapTable

Highlight a row using an adaptable style

Highlight rows using an adaptable style

Checks if given Grid Cell is editable

Checks if given Grid Cell has been edited (uses Data Change History)

Checks if all of given Grid Cells are editable

Whether given Row Node is a Grand Total Row

isGridGroupable()
returns

boolean

Whether AdapTable instance can be Row Grouped

isGridInPivotMode()
returns

boolean

Whether Grid is currently in Pivot Mode

isGridPivotable()
returns

boolean

Whether AdapTable instance can be pivoted

Whether AdapTable instance offers cell range selection

isGridRowGrouped()
returns

boolean

Whether Grid is currently showing Row Groups

isGridRowSelectable()
returns

boolean

Whether AdapTable instance offers row selection

Whether a Row is selected

Whether given Row Node is a Row Group

isMasterDetailGrid()
returns

boolean

Whether Grid is a Master Detail Grid

Whether Quick Filter is available in the Grid

Whether given Row Node is in a Summary Row

isTreeDataGrid()
returns

boolean

Whether Grid displays a Tree Data (structured hierarchical data)

Whether given Row Node is visible

Grid will jump to cell in a given Row and Column

Grid will jump to Column that has given ColumnId

Grid will jump to Row containing given Primary Key Value

Loads data into grid and fire a RowChanged.trigger='Load' event

manageGridData(dataRowConfig, dataUpdateConfig)
returns

Promise<{ addedRows: IRowNode[]; updatedRows: IRowNode[]; removedRows: IRowNode[]; }>

Adds, Updates or Deletes rows in AdapTable (and AG Grid) in single transaction

Opens Settings Panel with Grid Info section selected and visible

redrawGrid()
returns

void

Redraws AdapTable (expensive operation so use sparingly)

Refreshes all Cells in the Grid

Refresh a Cell Value in AdapTable

Refresh Cell Values in AdapTable

Refresh Column Values in AdapTable

Refresh Columns Values in AdapTable

Refreshes a single Grid Cell

Refreshes a set of Grid Cells

Forces a re-render of the Grid Header

Forces a re-render of all Group Rows (including aggregations)

Forces a re-render of Row with given Primary Key value

Forces a re-render of the given row

Forces re-render of given rows (if none provided, all rows are refreshed)

Removes the Column Definition for a given Column.

selectAll()
returns

void

Select the whole Grid

Selects a group of cells in a given range - provide either primary keys or row indexes

Selects a group of cells in a given range using a query

Selects a Column in AG Grid

Selects Columns in AG Grid

Selects the AG Grid Row Node in AdapTable

Selects the AG Grid Row Nodes in AdapTable

Selects Row with given Primary Key Value

Selects Rows with given Primary Key Values

Sorts AdapTable using given Column Sorts

Replaces the grid's column definitions.

Updates cell in AdapTable (as an AG Grid edit)

Updates multiple cells

Sets the grid to Row Group

Opens a window with a transposed view of the grid.

Reverses a data change (if triggered by cell edit)

Unhighlights all highlighted Cells in AdapTable

Unhighlights all highlighted Columns in AdapTable

Remove all highlighted rows

Unhighlights a Cell in AdapTable

Unhighlights a Column in AdapTable

Remove highlight from Row

Remove highlight from given Rows

Merges non-stateful AG Grid column properties into an existing column definition. The column is matched by colId. A column that does not exist yet is added.

Merges non-stateful AG Grid column properties into the given column definitions. Each column is matched by colId.

Updates Ag Grid Column State for a given Column; use to update STATEFUL AG Grid Column props

Updates Ag Grid Column State for given Columns; use to update STATEFUL AG Grid Column props

updateGridData(dataRows, config)
returns

Promise<IRowNode[]>

Updates AdapTable (and AG Grid) with rows that have changed


Row Changed Event

The Row Changed Event fires whenever rows are loaded, added, updated or deleted through the Grid API, or when a Create, Clone, Edit or Delete Action Column Command is used.

RowChangedInfo

The event provides the RowChangedInfo object:

rowDataChange is a RowDataChangedInfo:

rowTrigger is set by the Grid API function that made the change:

TriggerGrid API function
LoadloadGridData
AddaddGridData
UpdateupdateGridData
DeletedeleteGridData

Event Subscription

Subscribing to the Event is done the same way as with all Adaptable Events:

api.eventApi.on('RowChanged', (eventInfo: RowChangedInfo) => {
    // do something with the info
});

Find Out More

See Listening to Cell and Row Changes for a worked example