Selecting Technical Reference
Summary
- AdapTable provides 2 Selection-related Events
- Cell Selection Changed Event
- Row Selection Changed Event
Important
- This page documents the 2 selection related events
- Row selection behaviour is configured on the Layout — see Row Selection in Table Layouts
- Cell selection uses AG Grid's
CellSelectionmodule andGridOptions.cellSelection— see Selecting Grid Data
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:
CellSelectionChangedInfo
Payload of the CellSelectionChanged event.
Fires when the cell selection changes, after AdapTable has updated its selected-cell state. Row selection does not fire this event.
Extends , so adaptableApi is included.
Cells selected after this change. gridCells is empty when nothing is selected.
Custom application Context provided in AdaptableOptions.adaptableContext
Selected Cell Info
The selectedCellInfo property is a SelectedCellInfo object which contains 2 arrays:
SelectedCellInfo
Describes which Cells are currently selected in AdapTable
AdaptableColumn<TData>[]
Array of Columns which have selected cells
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:
GridCell
Defines a Cell in Adaptable - every cell is an intersection of a Column Id and a Primary Key Value
AdaptableColumn<TData>
Column in which Cell is situated
any
Display value of Cell (e.g. if formatted)
boolean
Is Cell in a Pivot Column
boolean
Is Cell in a Row Group Column
Normalised value of Cell
any
Primary Key column's value in row - how Adaptable locates the Cell
any
Raw value of Cell
IRowNode<TData>
AG Grid Row Node that holds the Cell
boolean
Is 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:
RowSelectionChangedInfo
Payload of the RowSelectionChanged event.
Fires when the row selection changes, after AdapTable has updated its selected-row state. Cell selection does not fire this event.
Extends , so adaptableApi is included.
Rows selected after this change. gridRows is empty when nothing is selected.
Custom application Context provided in AdaptableOptions.adaptableContext
Selected Row Info
The selectedRowInfo property is a SelectedRowInfo object which contains a single collection:
SelectedRowInfo
Description of currently selected Rows in AdapTable
Grid Row
The GridRow object provides full information about the selected row including its underlying data:
GridRow
Detailed information about a Row in AdapTable
Row Info
The rowInfo property (of type RowInfo) contains a number of very useful boolean properties:
RowInfo
Provides meta data about a Row in Adaptable
boolean
Is Row displayed (ie. filtered, not necessarily in viewport)
boolean
Is Row expanded (if a group row)
boolean
Is Row grouped
boolean
Is Row a Master Row (in a Master-Detail grid)
boolean
Is Row selected
number
What 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
});