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:
| Property | Description |
|---|---|
| selectedCellInfo | Details of Cells currently selected in the Grid |
| adaptableContext | Custom application Context provided in AdaptableOptions.adaptableContext |
Selected Cell Info
The selectedCellInfo property is a SelectedCellInfo object which contains 2 arrays:
| Property | Description |
|---|---|
| columns | Array of Columns which have selected cells |
| gridCells | 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:
| Property | Description |
|---|---|
| column | Column in which Cell is situated |
| displayValue | Display value of Cell (e.g. if formatted) |
| isPivotCell | Is Cell in a Pivot Column |
| isRowGroupCell | Is Cell in a Row Group Column |
| normalisedValue | Normalised value of Cell |
| primaryKeyValue | Primary Key column's value in row - how Adaptable locates the Cell |
| rawValue | Raw value of Cell |
| rowNode | AG Grid Row Node that holds the Cell |
| visible | 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:
| Property | Description |
|---|---|
| selectedRowInfo | Details of Rows currently selected in the Grid |
| adaptableContext | Custom application Context provided in AdaptableOptions.adaptableContext |
Selected Row Info
The selectedRowInfo property is a SelectedRowInfo object which contains a single collection:
| Property | Description |
|---|---|
| gridRows | 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:
| Property | Description |
|---|---|
| primaryKeyValue | Primary Key column's value for Row - how Adaptable locates a cell |
| rowData | Actual data in the Row |
| rowInfo | Object which provides 'meta data' about the Row |
| rowNode | AG Grid Row Node object for the Row |
Row Info
The rowInfo property (of type RowInfo) contains a number of very useful boolean properties:
| Property | Description |
|---|---|
| isDisplayed | Is Row displayed (ie. filtered, not necessarily in viewport) |
| isExpanded | Is Row expanded (if a group row) |
| isGroup | Is Row grouped |
| isMaster | Is Row a Master Row (in a Master-Detail grid) |
| isSelected | Is Row selected |
| rowGroupLevel | 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
});