Selecting Technical Reference

Summary

  • AdapTable offers 2 Selection Changed Event:
    • Cell Selection Event - fires whenever selected cells change in AdapTable
    • Row Selection Event - fires whenever selected rows change in AdapTable

Cell Selection Changed Event

The Cell Selection Changed Event will fire whenever cell (or column) selection in AG Grid changes.

Cell Selection Changed Info

The event contains a single cellSelectionChangedInfo property, of type CellSelectionChangedInfo.

This includes full details of all Selected Cells and Rows in AG Grid:

PropertyTypeDescription
selectedCellInfoSelectedCellInfoDetails of Cells currently selected in the Grid
adaptableContextanyCustom application Context provided in AdaptableOptions.adaptableContext

Selected Cell Info

The selectedCellInfo property is a SelectedCellInfo object which contains 2 arrays:

PropertyTypeDescription
columnsAdaptableColumn<TData>[]Array of Columns which have selected cells
gridCellsGridCell<TData>[]Array of GridCells (which provide cell value, primary kev value and other info)

The columns property is an Adaptable Column array.

Hint

Use this to see if the Column is ReadOnly or a special type of Column

Grid Cells

The gridCells property is a GridCell array which provides full information about the Selected Cell:

PropertyTypeDescription
columnAdaptableColumn<TData>Column in which Cell is situated
displayValueanyDisplay value of Cell (e.g. if formatted)
isPivotCellbooleanIs Cell in a Pivot Column
isRowGroupCellbooleanIs Cell in a Row Group Column
normalisedValueanyNormalised value of Cell
primaryKeyValueanyPrimary Key column's value in row - how Adaptable locates the Cell
rawValueanyRaw value of Cell
rowNodeIRowNode<TData>AG Grid Row Node that holds the Cell
visiblebooleanIs Cell in a currently filtered Row

Row Selection Changed Event

The Row Selection Changed Event will fire whenever row selection in AG Grid changes.

Row Selection Changed Info

The event contains a single rowSelectionChangedInfo property, of type RowSelectionChangedInfo.

This includes full details of all Selected Rows in AG Grid:

PropertyTypeDescription
selectedRowInfoSelectedRowInfoDetails of Rows currently selected in the Grid
adaptableContextanyCustom application Context provided in AdaptableOptions.adaptableContext

Selected Row Info

The selectedRowInfo property is a SelectedRowInfo object which contains a single collection:

PropertyTypeDescription
gridRowsGridRow<TData>[]Array of Grid Rows containing full information about a row in AdapTable

Grid Row

The GridRow object provides full information about the selected row including its underlying data:

PropertyTypeDescription
primaryKeyValueanyPrimary Key column's value for Row - how Adaptable locates a cell
rowDataTDataActual data in the Row
rowInfoRowInfoObject which provides 'meta data' about the Row
rowNodeIRowNode<TData>AG Grid Row Node object for the Row

Row Info

The rowInfo property (of type RowInfo) contains a number of very useful boolean properties:

PropertyTypeDescription
isDisplayedbooleanIs Row displayed (ie. filtered, not necessarily in viewport)
isExpandedbooleanIs Row expanded (if a group row)
isGroupbooleanIs Row grouped
isMasterbooleanIs Row a Master Row (in a Master-Detail grid)
isSelectedbooleanIs Row selected
rowGroupLevelnumberWhat level the Row is (if Row Grouping is active)

Events Subscription

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

api.eventApi.on('CellSelectionChanged', (eventInfo: CellSelectionChangedInfo) => {
    // do something with the info
});
api.eventApi.on('RowSelectionChanged', (eventInfo: RowSelectionChangedInfo) => {
    // do something with the info
});