Grid API
Provides access to important elements of the actual grid in AdapTable like sorting, selected cells etc.
Setting Grid Data
There are 2 methods that allow the entire Grid to be repopulated.
Both can receive any data from any datasource that is suitable for the underlying grid.
setGridData(data: any): void
note
Typically used after SearchChangedEvent, when filtered data from server is sent bback to AdapTable
loadGridData(data: any): void
note
Designed for first time use; identical to
setGridData
but Adaptable will reload Layout (useful if there are opened row groups)
Changing Grid Data
The Grid API provides a set of useful functions to add / edit / delete rows in AdapTable:
- addGridData(dataRows: any[], config?: DataUpdateConfig): void;
- updateGridData(dataRows: any[], config?: DataUpdateConfig): void;
- deleteGridData(dataRows: any[], config?: DataUpdateConfig): void;
caution
These functions work directly on the data set in the underlying Grid; this means that they will not first perform Cell Validation (for that you use setCellValue
or setGriddCell
).
Each of these takes an optional DataUpdateConfig property defined as follows:
Property | Description |
---|---|
callback | Callback function to run when the batch successfully updates |
runAsync | Whether data should be updated aysnchoronously |
note
These methods ultimately call ag-Grid applyTransaction
(or applyTransactionAsync
if 'runAsync' has been set) if using ag-grid as Vendor Grid.
Changing Cell Values
The Grid API has a function which enables you to update a single cell value:
- setCellValue(columnId, newValue, primaryKeyValue, forceFilter): void;
The function requires the Column's Id and Row's PrimaryKeyValue, together with the new value.
There is also an option to refilter the grid automatically after the cell is updated (the default is false).
warning
Unlike the changing Grid Data methods above, this will first trigger any Cell Validation or Server Validation and only be applied if they are both successful.
Destroying the Grid
There is a useful destroy()
method which will destroy the current AdapTable instance.
This only needs to be used when using AdapTable 'Core' version.
tip
Grid API Methods
Method | Description |
---|---|
addGridData(dataRows, config) | Adds rows to Adaptable (and underlying grid) |
applyGridFiltering() | Applies current Filtering and Searching in AdapTable |
clearGridFiltering() | Removes all current Filters and Searches in AdapTable |
closeAllRowGroups() | Close all open groups in Row Grouping |
deleteGridData(dataRows, config) | Deletes rows from Adaptable (and underlying grid) |
destroy() | Destroys current AdapTable instance |
expandAllRowGroups() | Expands all closed groups in Row Grouping |
expandRowGroupsForValues(columnValues) | Expands Row Groups that contain given keys |
fireGridDataChangedEvent(dataChangedInfo) | Fires Grid Data Changed Event - when any data in vendor grid data set has changed |
fireSearchChangedEvent(searchChangedTrigger, searchAtDate) | Fires Search Changed Event - typically used to enable server searching and filtering |
getCellDisplayValue(primaryKeyValue, columnId) | Retrieves Display Value for a given cell |
getCellNormalisedValue(primaryKeyValue, columnId) | Retrieves Normalised Value for a given cell |
getCellRawValue(primaryKeyValue, columnId) | Retrieves Raw Value for a given cell |
getColumnSortForColumn(columnId) | Retrieves ColumnSort for a given Column |
getColumnSorts() | Returns Column Sort information in Adaptable |
getDisplayValueFromRowNode(rowwNode, columnId) | Retrieves Raw Value for Cell in given Row and Column |
getExpandRowGroupsKeys() | Get keys for any open rows in Row Grouping |
getFirstRowNode() | Retrieves the first Row Node in AdapTable |
getGridCellFromRowNode(rowwNode, columnId) | Retrieves Cell in given Row and Column |
getGridState() | Returns Grid section from Adaptable State |
getNormalisedValueFromRowNode(rowwNode, columnId) | Retrieves Normalised Value for Cell in given Row and Column |
getPrimaryKeyValueForRowNode(rowNode) | Returns the Primary Kev Value for a given Row Node |
getRawValueFromRowNode(rowwNode, columnId) | Retrieves Display Value for Cell in given Row and Column |
getRowNodeForPrimaryKey(primaryKeyValue) | Retrieves Row Node that contains given Primary Key |
getRowNodesForPrimaryKeys(primaryKeyValues) | Retrieves Row Nodes that contain given Primary Keys |
getSelectedCellInfo() | Returns all current Selected Cells in AdapTable |
getSelectedRowInfo() | Returns all current Selected Rows in AdapTable |
getVendorGrid() | Returns underlying Vendor Grid (object passed into Adaptable Options at start-up) |
hideFilterForm() | Hides the AdapTable Filter Form |
highlightCell(cellHighlightInfo) | Highlights a Cell in AdapTable |
isGridGroupable() | Whether AdapTable instance can be Row Grouped |
isGridPivotable() | Whether AdapTable instance can be pivoted |
isGridRowGrouped() | Whether Grid is currently showing Row Groups |
isGroupRowNode(rowNode) | Whether given Row Node is a Row Group |
jumpToCell(primaryKeyValue, columnId) | Grid will jump to cell in a given Row and Column |
jumpToColumn(columnId) | Grid will jump to Column that has given ColumnId |
jumpToRow(primaryKeyValue) | Grid will jump to Row containing given Primary Kev Value |
loadGridData(data) | Loads grid with given data |
redrawGrid() | Redraws AdapTable (expensive operation so use sparingly) |
refreshCells(rowNodes, columnIds) | Refresh Cells in AdapTable |
selectNode(rowNode) | Selects given Row Node in AdapTable |
selectNodes(rowNodes) | Selects given Row Nodes in AdapTable |
setCellValue(columnId, newValue, primaryKeyValue, forceFilter) | Updates cell in Adaptable (first performs Cell & Server Validation) |
setColumnSorts(columnSorts) | Sets Column Sorts in Grid |
setGridData(data) | Repopulates grid with given data |
sortAdaptable(columnSorts) | Sorts AdapTable using given Column Sorts |
unhighlightAllCells() | Unhighlights all highlighted Cells in AdapTable |
unhighlightCell(cellHighlightInfo) | Unhighlights a Cell in AdapTable |
updateGridData(dataRows, config) | Updates Adaptable (and underlying grid) with rows that have changed |
See API documentation for full details of all available functions with lists of parameters