# Selecting Grid Data

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

- AdapTable builds on the cell and row Selection in AG Grid by adding extra functionality including:
  - Full summary information of selected cells using multiple operations (including custom ones)
  - Methods in Grid API which allow cells and rows to be selected programmatically
  - The Selected Data Report which exports data about currently selected cells
  - A Selection Changed Event which provides full details about the current selection

Cell and Row Selection is an important and well-supported run-time user feature in AG Grid.

AdapTable provides many features which enhance and augment this.

- **Row** Selection props are configured in AdapTable in [Layouts](https://www.adaptabletools.com/docs/handbook-layouts-table-row-selection/index.md) (`RowSelection`); don't set `gridOptions.rowSelection`
- **Cell** Selection requires the `CellSelection` [AG Grid Module](https://ag-grid.com/javascript-data-grid/modules/#selecting-modules) and `cellSelection` in `GridOptions`

- This section is about **using** a selection — API, events, export and Cell Summaries etc.
- Checkbox column and row-selection behaviour is described in [Row Selection in Table Layouts](https://www.adaptabletools.com/docs/handbook-layouts-table-row-selection/index.md)

## Cell and Row Selection Topics

Cell and row selection is documented in several places, depending on the use case:

| Topic | Summary |
| ----- | ------- |
| [Exporting Grid Data](https://www.adaptabletools.com/docs/handbook-exporting/index.md) (`Selected Cells` report) | Export the current cell/row selection |
| [Selecting Using Grid API Functions](https://www.adaptabletools.com/docs/handbook-selecting-configuring/index.md) | `selectCellRange`, expressions, columns, rows, select all |
| [Selection Changed Events](https://www.adaptabletools.com/docs/handbook-selecting-changed-event/index.md) | `CellSelectionChanged` and `RowSelectionChanged` demos |
| [Row Selection in Table Layouts](https://www.adaptabletools.com/docs/handbook-layouts-table-row-selection/index.md) | Checkboxes, mode, header checkbox, click behaviour, grouping (`RowSelection` on the Layout) — do not set `gridOptions.rowSelection` |
| [Summarising Cells](https://www.adaptabletools.com/docs/handbook-summarising/index.md) | Cell Summary for the current selection |
| [Selecting Technical Reference](https://www.adaptabletools.com/docs/technical-reference-selecting/index.md) | Event payloads and subscription |
| [Highlighting & Jumping Cells](https://www.adaptabletools.com/docs/handbook-highlighting-jumping/index.md) | Often used together with selection-driven behaviour |

AdapTable builds on the selection capabilities of AG Grid by providing these additional features:

- Displaying (customisable) [Cell Summary](https://www.adaptabletools.com/docs/handbook-summarising-cells/index.md) information of selected cells
- Grid API functions enable run-time selection and highlighting of cells
- `Selected Cells` Report is available to export selected data

## Exporting Cell Selection

A common requirement is to select a range of cells or rows and export them from AG Grid to another location.

AdapTable wraps up the current cell and row selection in the [Selected Cells System Report](https://www.adaptabletools.com/docs/handbook-exporting-reports/index.md).

The Selected Cells (System) Report is available for export in 2 ways:

- `Export Selected Cells` Menu Item in the [Context Menu](https://www.adaptabletools.com/docs/ui-context-menu/index.md) 

Using the Context Menu item exports the Report to Excel only

- Selecting the  [Report](https://www.adaptabletools.com/docs/handbook-exporting/index.md#running-reports) in the Export Toolbar, ToolPanel or Status Bar
 

This will export the selected data to any available export destination

## Selecting through API

The [`Grid API`](https://www.adaptabletools.com/docs/reference/gridapi.md) includes many helpful selection related functions, including:

- selecting cell ranges using row indexes or primary keys (with timeouts)
- selecting columns
- unselecting cells or columns

See [Selecting Using Grid API Functions](https://www.adaptabletools.com/docs/handbook-selecting-configuring/index.md) for more information and multiple demos

## Selection Changed Event

AdapTable fires the [Selection Changed Event](https://www.adaptabletools.com/docs/handbook-selecting-changed-event/index.md) whenever the cell or row selection in AG Grid changes.

This provides very detailed information of the new Grid selection.

## Selected Cells Summaries

AdapTable's [Cell Summary Module](https://www.adaptabletools.com/docs/handbook-summarising-cells/index.md) provides comprehensive information about the currently selected Cells.

This includes a number of Summary Operations provided by AdapTable (e.g. sum, count, average etc) and custom summary operations provided by developers.

Selected cells in pinned rows (Row Summaries, a pinned Grand Total Row, or rows pinned with [AG Grid Row Pinning](https://ag-grid.com/react-data-grid/row-pinning/)) are not included in the selected cell information or the Cell Summary. A range that reaches into the pinned rows covers the body rows up to the top or bottom of the grid, and a pinned row's own body row is counted once if the range covers it.

See [Summarising Selected Cells](https://www.adaptabletools.com/docs/handbook-summarising/index.md) for full details

## Configuring Row Selection

How rows are selected — single vs multi, the checkbox Selection Column, click behaviour, grouping — is configured on the Layout, not in this section.

See [Row Selection in Table Layouts](https://www.adaptabletools.com/docs/handbook-layouts-table-row-selection/index.md) for the full `RowSelection` options, checkbox visibility, and demos

### FAQ

**Why am I unable to select a range of cells?**
Register the `CellSelection` [AG Grid Module](https://ag-grid.com/javascript-data-grid/modules/#selecting-modules) and set `cellSelection` in `GridOptions`.
Row selection (mode, checkboxes, click behaviour) is configured on the [Layout](https://www.adaptabletools.com/docs/handbook-layouts-table-row-selection/index.md) — do not set `gridOptions.rowSelection`.

**Does selection affect Bulk Update?**
[Bulk Update](https://www.adaptabletools.com/docs/handbook-editing-bulk-update/index.md) runs on whatever cells you have selected in editable columns — see that topic for UI entry points and behaviour.
