Adaptable API

The AdapTable API provides full, programmatic, run-time, access to all functionality provided by AdapTable.

It enables developers to access the AdapTable State, and AdapTable Modules, at run-time in a 'safe' way.

note

The Adaptable API is essentially just a wrapper around the AdapTable Store but provides additional error-checking, logging, and auditing; it thereby ensures that the data in the store remains immutable.

The AdapTable API also allows users programmtically to add / edit / delete Adaptable Objects

note

Whenever an object is added or edited in the API, the invoked function always returns the new object

Anything that can be done in the AdapTable UI is also available programatically via the Adaptable API.

This allows users to manage AdapTable objects in custom screens completely bypassing AdapTable's UI.

important

We try to keep the API as rich as possible so please contact Adaptable Support if a method is missing from the Adaptable API that would be benefical.

warning

The Adaptable API should be all you need to access Adaptable programmatically and is the only public, documented interface that is guaranteed not to change between versions

Accessing the Adaptable API

The Adaptable API is the only object returned by the AdapTable static constructor.

tip

If you are using one of the Framework Wrappers then the Adaptable API is available in the AdaptableReadyInfo object provided by the AdaptableReady event.

API Classes

The Adaptable API consists of a large set of properties; each is a class that contains a set of API methods grouped either by AdapTable Module (e.g. conditionalStyleApi) or type (e.g. predicateApi).

In addition there are a few api classes designed primarily for internal use which deal with how AdapTable itself works (e.g. gridApi).

Module-Related API classes

caution

The Audit Event API class was removed in Version 9 in favour of the Adaptable State Changed Event

API ClassDetails
alertApiAdaptable Alerts provide bespoke notifications and messages
applicationApiUse Application Data Entries to manage custom state and data
bulkUpdateApiRun Bulk Update so mutliple selected cells are given same value
calculatedColumnApiManages Calculated Columns which contain custom expressions
cellSummaryApiChoose which Cell Summaries to display when cells are selected
conditionalStyleApiSet bespoke Conditional Styles for rows and columns depending on cell data
customSortApiManages Custom Sorts allowing bespoke column sorting
dashboardApiLarge series of functions allowing full customisation of AdapTable's Dashboard
dataChangeHistoryApiConfigures the Data Change History which tracks data changes
dataSourceApiDeals with Data Sources used in Server Searching
exportApiExport reports either manually or at scheduled times
filterApiManages various Filters provided by AdapTable
freeTextColumnApiConfigures FreeText Columns - special columns containing bespoke data
layoutApiManages Layouts - sets of column order and visibility
queryApiFunctions relating to the saveable, cross-column Queries
quickSearchApiFunctions for running and clearing Quick Search
scheduleApiSupports Schedules for running Actions at set time
shortcutApiDeals with Shortcuts for faster & safer data entry
smartEditApiFunctions for managing the Smart Edit Module to enable better editing
systemStatusApiManages how the System Status Module will display run-time messages
themeApiDeals with Themes both AdapTable and Custom
toolPanelApiFunctions for working with the AdapTable ToolPanel Component

General API classes

API ClassDetails
columnApiLarge number of column-related functions
configApiSeries of functions managing Predefined Config and User State
eventApiSubscribe to some of the many Events that AdapTable fires
gridApiSeries of Grid-management related functions e.g. get/set data
predicateApiHelper functions for the Predicate - boolean return function
queryLanguageApiManages AdapTableQL (AdapTable's Query Language)
scopeApiMany methods to manage the Scope object
userInterfaceApiMany properties and methods to manage the User Interface

Plugin-related API classes

API ClassDetails
pluginsApiSeries of functions for when using Plugins
chartApiDeals with the Chart functionality (available through a plugin)
glue42ApiFunctions to faciliate using the Glue42 plugin
ipushpullApiFunctions to help export data from AdapTable to ipushull
openfinApiUsed in conjunction with the OpenFin plugin

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)

warning

If you are using an Auto Generated Primary Key then these methods must be used to populate the Grid

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 check for Prevent Edit Alerts (for that you use setCellValue or setGriddCell).

Each of these takes an optional DataUpdateConfig property defined as follows:

PropertyDescription
addIndexIndex where to add new rows
callbackCallback function invoked when a batch successfully updates
runAsyncWhether data should be updated asynchronously
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 Prevent Edit Alerts 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

The React and Angular wrappers automatically call this as lifecycle method when component is destroyed

Grid API Methods

MethodDescription
addGridData(dataRows, config)Adds rows to Adaptable (and underlying grid)
applyGridFiltering()Applies current Filtering and Searching in AdapTable
areCellsEditable(gridCells)Checks if given set of Grid Cells are editable
clearAdaptableSorting()Removes Column Sorts in AdapTable
clearGridFiltering()Removes all current Filters and Searches in AdapTable
clearRowGroupColumns()Clears Row Grouping in the Grid
closeAllRowGroups()Close all open groups in Row Grouping
deleteGridData(dataRows, config)Deletes rows from Adaptable (and underlying grid)
deselectAll()Deselects all selected rows, cells and ranges
deSelectNode(rowNode, clearSelection)Deselects the AG Grid Row Node in AdapTable
deSelectNodes(rowNodes, clearSelection)AG Grid Row Nodes in AdapTable
deSelectRow(primaryKeyValue, clearSelection)Deselects Row with given Primary Key Value
deSelectRows(primaryKeyValues, clearSelection)Deselects Row with given Primary Key Values
destroy()Destroys current AdapTable instance
expandAllRowGroups()Expands all closed groups in Row Grouping
expandRowGroupsForValues(columnValues)Expands Row Groups that contain given keys
fireCellChangedEvent(cellChangedInfo)Fires Grid Data Changed Event - when any data in vendor grid data set has changed
fireGridDataChangedEvent(dataRows, rowTigger)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
getColumnCount()Returns number of columns in Data Source
getColumnSortForColumn(columnId)Retrieves ColumnSort for a given Column
getColumnSorts()Returns Column Sort information in Adaptable
getDisplayValueFromRowNode(rowNode, columnId)Retrieves Display Value for Cell in given Row and Column
getEntitlementAccessLevelForModule(adaptableModule)Retrieves the Entitlement Access Level for a given Adaptable Module
getExpandRowGroupsKeys()Get keys for any open rows in Row Grouping
getFilteredData()Retrieves filtered data from the grid
getFirstRowNode()Retrieves the first Row Node in AdapTable
getFormattedValueFromRawValue(columnId, rawValue)Retrieves Formatted Value for a given Raw Value in given Column
getGridCellFromRowNode(rowNode, columnId)Retrieves Cell in given Row and Column
getGridContainerElement()Returns the Grid Container in which the Adaptable Instance is present
getGridData()Retrieves all data from the grid
getGridState()Returns Grid section from Adaptable State
getNormalisedValueFromRowNode(rowNode, columnId)Retrieves Normalised Value for Cell in given Row and Column
getPrimaryKeyValueForRowNode(rowNode)Returns the Primary Kev Value for a given Row Node
getRawValueFromRowNode(rowNode, columnId)Retrieves Raw Value for Cell in given Row and Column
getRowCount()Returns number of rows in Data Source
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)
getVisibleColumnCount()Returns number of visible columns in Data Source
getVisibleRowCount()Returns number of visible rows in Data Source
getVisibleRowNodes()Retrieves all Row Nodes currently in the Grid (i.e. filtered)
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
isGridSelectable()Whether AdapTable instance offers cell selection
isGroupRowNode(rowNode)Whether given Row Node is a Row Group
isQuickFilterAvailable()Whether Quick Filter is available in the Grid
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
refreshRow(primaryKey)Forces a render of a row
selectAll()Select the whole Grid
selectCellRange(gridCellRange)Selects a group of cells in a given range
selectNode(rowNode, clearSelection)Selects the AG Grid Row Node in AdapTable
selectNodes(rowNodes, clearSelection)Selects the AG Grid Row Nodes in AdapTable
selectRow(primaryKeyValue, clearSelection)Selects Row with given Primary Key Value
selectRows(primaryKeyValues, clearSelection)Selects Rows with given Primary Key Values
setAdaptableSorting(columnSorts)Sorts AdapTable using given Column Sorts
setCellsValue(gridCells)Updates multiple cells
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
setRowGroupColumns(columnIds)Sets the grid to Row Group
undoCellEdit(dataChangedInfo)Reverses a data change (if triggered by cell edit)
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

Column API

The Column API section of the Adaptable API is used for managing, selecting and retrieving Columns.

caution

Most of these methods are for internal use

MethodDescription
autosizeAllColumns()Autosizes all Columns in the Grid
autosizeColumn(columnId)AutoSizes a Column
autosizeColumns(columnIds)Autosizes given Columns
doesColumnExist(columnId)Returns true if the given Column exists in the Grid
getAggregetableColumns()Returns all Aggregatable Columns
getAllColumnFriendlyNames()Retrieves a list providing the Friendly Name / Caption for all columns
getBooleanColumns()Returns all boolean Columns
getColumnDataTypeFromColumnId(columnId)Returns Data Type for a Column
getColumnFromFriendlyName(columnName)Retrieves Adaptable Column with given Friendly name
getColumnFromId(columnId, logWarning)Retrieves Adaptable Column with given ColumnId
getColumnIdFromFriendlyName(friendlyName)Retrieves ColumnId for Column with given Friendly Name
getColumnIdsFromFriendlyNames(friendlyNames)Retrieves ColumnIds for Columns with given Friendly Names
getColumnIdsFromId(columnId, logWarning)Returns the ColumnId if regular, otherwise referenced columns if Calculated Column
getColumns()Returns all Columns
getColumnsFromFriendlyNames(friendlyNames)Retrieves Adaptable Columns with given Friendly names
getColumnsFromIds(columnIds)Retrieves Adaptable Columns with given ColumnIds
getColumnsOfType(dataType)Returns all Columns that have given DataType
getDateColumns()Returns all Date Columns
getDistinctBulkUpdateDisplayValuesForColumn(columnId, selectedGridCells)Gets all distinct column display values for bulk update.
getDistinctCustomSortDisplayValuesForColumn(columnId)Gets all distinct column display values in for custom sort.
getDistinctDisplayValuesForColumn(columnId)Gets all distinct display values in the Column
getDistinctFilterDisplayValuesForColumn(columnId, filter)Gets all distinct display values in for filter column, used for Floating Filter and Column Header filter
getDistinctRawValuesForColumn(columnId, skipRowNode)Gets all distinct raw values in Column
getDistinctVisibleDisplayValuesForColumn(columnId)Gets all distinct visible display values in the Column
getDistinctVisibleRawValuesForColumn(columnId)Gets all distinct visible raw values in the Column
getFriendlyNameFromColumn(columnId, column)Retrieves Friendly Name for a given Column
getFriendlyNameFromColumnId(columnId)Retrieves Friendly Name for a given ColumnId
getFriendlyNamesFromColumnIds(columnIds)Retrieves Friendly Names for given ColumnIds
getGroupableColumns()Returns all Groupable Columns
getNumericArrayColumns()Returns all numeric array Columns
getNumericColumns()Returns all numeric Columns
getPivotableColumns()Returns all Pivotable Columns
getPrimaryKeyColumn()Retrieves current Primary Key Column in AdapTable
getQueryableColumns()Returns all Queryable Columns
getSortableColumns()Returns all Sortable Columns
getStringColumns()Returns all string Columns
getVendorColumnType(columnId)Retrieves 'ColumnType' property for a given Column
getVendorGridColumnFieldForColumn(columnId)Retrieves the field property for the column
getVisibleColumns()Returns all visible Columns
hideColumn(columnId)Hides a Column from Grid
isActionColumn(columnId)Is Column an Action Column
isBooleanColumn(column)Is Column Boolean
isCalculatedColumn(columnId)Is Column a Calculated Column
isColumnReferencedInExpression(columnId, expression)Checks if a column is referenced in a given Expression
isDateColumn(column)Is Column a Date
isFormatNumericStyleColumn(column)Does Column have a numeric style (e.g. Percent Bar or Gradient)
isFreeTextColumn(columnId)Is Column a Free Text Column
isNumericColumn(column)Is Column Numeric
isRowGroupColumn(columnId)Is Column row-grouped
selectAllColumns()Selects all Columns
selectColumn(columnId)Selects (highlights) a Column
selectColumns(columnIds)Selects (highlights) group of Columns
showColumn(columnId)Makes a Column visible
usesAdaptableFilterForm(columnId)Does Column use AdapTable's Filter Form
usesAdaptableQuickFilter(columnId)Does Column use AdapTable's Quick Filter

Config API

The Config API is used for managing Adaptable State and Predefined Config.

It contains multiple methods for managing - and primarily retrieving - User State:

MethodDescription
configInit()Initialised Adaptable State (for internal use only)
copyAllStateToClipboard()Copies all Adaptable state to clipboard
copyUserStateToClipboard()Copies User State sections of Adaptable State to clipboard
dispatchStateReadyAction(module)Sent by each Module when it is Ready
getAdaptableSearchState()Gets search-related sections of Adaptable State
getAdaptableSortState()Gets sort-related sections of Adaptable State
getAlertState(returnJson)Returns Alert section of Adaptable State
getAllState()Retrieves ALL state which is currently stored by Adaptable (both User and internal)
getAllUserState()Retrieves the PERSISTED state in Adaptable
getApplicationState(returnJson)Returns Application section of Adaptable State
getCalculatedColumnState(returnJson)Returns Calculated Column section of Adaptable State
getChartState(returnJson)Returns Chart section of Adaptable State
getConditionalStyleState(returnJson)Returns Conditional Style section of Adaptable State
getCustomSortState(returnJson)Returns Custom Sort section of Adaptable State
getDashboardState(returnJson)Returns Dashboard section of Adaptable State
getDataSourceState(returnJson)Returns Data Source section of Adaptable State
getDescriptionForModule(adaptableModule)Retrieves a brief description of an AdapTable Module
getExportState(returnJson)Returns Export section of Adaptable State
getFilterState(returnJson)Returns Filter section of Adaptable State
getFormatColumnState(returnJson)Returns Formt Column section of Adaptable State
getFreeTextColumnState(returnJson)Returns FreeText Column section of Adaptable State
getHelpPageForModule(adaptableModule)Retrieves the help page for an AdapTable Module
getLayoutState(returnJson)Returns Layout section of Adaptable State
getPlusMinusState(returnJson)Returns Plus Minus section of Adaptable State
getPredefinedConfig()Returns current Predefined Config
getQueryState(returnJson)Returns Query section of Adaptable State
getQuickSearchState(returnJson)Returns Quick Search section of Adaptable State
getScheduleState(returnJson)Returns Schedule section of Adaptable State
getShortcutState(returnJson)Returns Shortcut section of Adaptable State
getSparklineColumnState(returnJson)Returns Sparkline Column section of Adaptable State
getThemeState(returnJson)Returns Theme section of Adaptable State
getToolPanelState(returnJson)Returns Tool Panel section of Adaptable State
getUserStateByStateKey(stateKey, returnJson)Returns given section of Adaptable State (as JSON or object)
incrementUerStateRevision(stateKey)Adds '1' to current revision number of State element
loadUserState(state)Loads supplied user state, replacing (not merging) existing User State.
reloadPredefinedConfig(newPredefinedConfig)Reloads either existing or supplied Predefined Config; deletes local storage and calls clearState function for remote storage removal
setAdaptableStateKey(adaptableStateKey, config)Changes the key used for persisting the Adaptablestate into localStorage

More Information