# Selecting Technical Reference

Canonical page: https://www.adaptabletools.com/docs/technical-reference-selecting

`## 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`](https://www.adaptabletools.com/docs/reference/cellselectionchangedinfo.md).

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

| Property | Type | Description |
| --- | --- | --- |
| [selectedCellInfo](https://www.adaptabletools.com/docs/reference/cellselectionchangedinfo.md#selectedcellinfo) | [`SelectedCellInfo`](https://www.adaptabletools.com/docs/reference/selectedcellinfo.md) | Cells selected after this change. `gridCells` is empty when nothing is selected. |
| [adaptableContext](https://www.adaptabletools.com/docs/reference/cellselectionchangedinfo.md#adaptablecontext) | `any` | Custom application Context provided in `AdaptableOptions.adaptableContext` |

---

### Selected Cell Info

The `selectedCellInfo` property is a [`SelectedCellInfo`](https://www.adaptabletools.com/docs/reference/selectedcellinfo.md) object which contains 2 arrays:

| Property | Type | Description |
| --- | --- | --- |
| [columns](https://www.adaptabletools.com/docs/reference/selectedcellinfo.md#columns) | [`AdaptableColumn`](https://www.adaptabletools.com/docs/reference/adaptablecolumn.md)`<TData>[]` | Array of Columns which have selected cells |
| [gridCells](https://www.adaptabletools.com/docs/reference/selectedcellinfo.md#gridcells) | [`GridCell`](https://www.adaptabletools.com/docs/reference/gridcell.md)`<TData>[]` | Selected cells. Each entry has the cell value, the Primary Key value and the column. Empty when nothing is selected. |

The `columns` property is an [Adaptable Column](https://www.adaptabletools.com/docs/dev-guide-columns-adaptable-column/index.md) array.

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

#### Grid Cells

The `gridCells` property is a [`GridCell`](https://www.adaptabletools.com/docs/reference/gridcell.md) array which provides full information about the Selected Cell:

| Property | Type | Description |
| --- | --- | --- |
| [column](https://www.adaptabletools.com/docs/reference/gridcell.md#column) | [`AdaptableColumn`](https://www.adaptabletools.com/docs/reference/adaptablecolumn.md)`<TData>` | Column in which Cell is situated |
| [displayValue](https://www.adaptabletools.com/docs/reference/gridcell.md#displayvalue) | `any` | Display value of Cell (e.g. if formatted) |
| [isPivotCell](https://www.adaptabletools.com/docs/reference/gridcell.md#ispivotcell) | `boolean` | Is Cell in a Pivot Column |
| [isRowGroupCell](https://www.adaptabletools.com/docs/reference/gridcell.md#isrowgroupcell) | `boolean` | Is Cell in a Row Group Column |
| [normalisedValue](https://www.adaptabletools.com/docs/reference/gridcell.md#normalisedvalue) | `any` | Normalised value of Cell |
| [primaryKeyValue](https://www.adaptabletools.com/docs/reference/gridcell.md#primarykeyvalue) | `any` | Primary Key column&#39;s value in row - how Adaptable locates the Cell |
| [rawValue](https://www.adaptabletools.com/docs/reference/gridcell.md#rawvalue) | `any` | Raw value of Cell |
| [rowNode](https://www.adaptabletools.com/docs/reference/gridcell.md#rownode) | `IRowNode<TData>` | AG Grid Row Node that holds the Cell |
| [visible](https://www.adaptabletools.com/docs/reference/gridcell.md#visible) | `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`](https://www.adaptabletools.com/docs/reference/rowselectionchangedinfo.md).

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

| Property | Type | Description |
| --- | --- | --- |
| [selectedRowInfo](https://www.adaptabletools.com/docs/reference/rowselectionchangedinfo.md#selectedrowinfo) | [`SelectedRowInfo`](https://www.adaptabletools.com/docs/reference/selectedrowinfo.md) | Rows selected after this change. `gridRows` is empty when nothing is selected. |
| [adaptableContext](https://www.adaptabletools.com/docs/reference/rowselectionchangedinfo.md#adaptablecontext) | `any` | Custom application Context provided in `AdaptableOptions.adaptableContext` |

---

### Selected Row Info

The `selectedRowInfo` property is a [`SelectedRowInfo`](https://www.adaptabletools.com/docs/reference/selectedrowinfo.md) object which contains a single collection:

| Property | Type | Description |
| --- | --- | --- |
| [gridRows](https://www.adaptabletools.com/docs/reference/selectedrowinfo.md#gridrows) | [`GridRow`](https://www.adaptabletools.com/docs/reference/gridrow.md)`<TData>[]` | Array of Grid Rows containing full information about a row in AdapTable |

#### Grid Row

The [`GridRow`](https://www.adaptabletools.com/docs/reference/gridrow.md) object provides full information about the selected row including its underlying data:

| Property | Type | Description |
| --- | --- | --- |
| [primaryKeyValue](https://www.adaptabletools.com/docs/reference/gridrow.md#primarykeyvalue) | `any` | Primary Key column&#39;s value for Row - how Adaptable locates a cell |
| [rowData](https://www.adaptabletools.com/docs/reference/gridrow.md#rowdata) | `TData` | Actual data in the Row |
| [rowInfo](https://www.adaptabletools.com/docs/reference/gridrow.md#rowinfo) | [`RowInfo`](https://www.adaptabletools.com/docs/reference/rowinfo.md) | Object which provides &#39;meta data&#39; about the Row |
| [rowNode](https://www.adaptabletools.com/docs/reference/gridrow.md#rownode) | `IRowNode<TData>` | AG Grid Row Node object for the Row |

#### Row Info

The `rowInfo` property (of type [`RowInfo`](https://www.adaptabletools.com/docs/reference/rowinfo.md)) contains a number of very useful boolean properties:

| Property | Type | Description |
| --- | --- | --- |
| [isDisplayed](https://www.adaptabletools.com/docs/reference/rowinfo.md#isdisplayed) | `boolean` | Is Row displayed (ie. filtered, not necessarily in viewport) |
| [isExpanded](https://www.adaptabletools.com/docs/reference/rowinfo.md#isexpanded) | `boolean` | Is Row expanded (if a group row) |
| [isGroup](https://www.adaptabletools.com/docs/reference/rowinfo.md#isgroup) | `boolean` | Is Row grouped |
| [isMaster](https://www.adaptabletools.com/docs/reference/rowinfo.md#ismaster) | `boolean` | Is Row a Master Row (in a Master-Detail grid) |
| [isSelected](https://www.adaptabletools.com/docs/reference/rowinfo.md#isselected) | `boolean` | Is Row selected |
| [rowGroupLevel](https://www.adaptabletools.com/docs/reference/rowinfo.md#rowgrouplevel) | `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](https://www.adaptabletools.com/docs/technical-reference-adaptable-events/index.md):

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

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