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:

PropertyDescription
selectedCellInfoDetails of Cells currently selected in the Grid
adaptableContextCustom application Context provided in AdaptableOptions.adaptableContext

Selected Cell Info

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

PropertyDescription
columnsArray of Columns which have selected cells
gridCellsArray 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:

PropertyDescription
columnColumn in which Cell is situated
displayValueDisplay value of Cell (e.g. if formatted)
isPivotCellIs Cell in a Pivot Column
isRowGroupCellIs Cell in a Row Group Column
normalisedValueNormalised value of Cell
primaryKeyValuePrimary Key column's value in row - how Adaptable locates the Cell
rawValueRaw value of Cell
rowNodeAG Grid Row Node that holds the Cell
visibleIs 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:

PropertyDescription
selectedRowInfoDetails of Rows currently selected in the Grid
adaptableContextCustom application Context provided in AdaptableOptions.adaptableContext

Selected Row Info

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

PropertyDescription
gridRowsArray 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:

PropertyDescription
primaryKeyValuePrimary Key column's value for Row - how Adaptable locates a cell
rowDataActual data in the Row
rowInfoObject which provides 'meta data' about the Row
rowNodeAG Grid Row Node object for the Row

Row Info

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

PropertyDescription
isDisplayedIs Row displayed (ie. filtered, not necessarily in viewport)
isExpandedIs Row expanded (if a group row)
isGroupIs Row grouped
isMasterIs Row a Master Row (in a Master-Detail grid)
isSelectedIs Row selected
rowGroupLevelWhat 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
});