---
title: "Multi-Row Selection"
framework: angular
version: "36.1.0"
---

# Multi-Row Selection

Enable users to select many rows at once within a grid.

## Enabling Multi-Row Selection

To enable multi-row selection set `rowSelection.mode` to `'multiRow'`:

```ts
<ag-grid-angular
    [rowSelection]="rowSelection"
    /* other grid options ... */ />

this.rowSelection = {
    mode: 'multiRow'
};
```

The following example illustrates a basic multi-row selection configuration.

#### Enabling Row Selection

```ts
import { Component } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { AgGridAngular } from "ag-grid-angular";
import {
  ClientSideRowModelModule,
  ColDef,
  ColGroupDef,
  GridApi,
  GridOptions,
  GridReadyEvent,
  ModuleRegistry,
  RowSelectionModule,
  RowSelectionOptions,
  enableDevValidations,
} from "ag-grid-community";
import {
  ColumnMenuModule,
  ColumnsToolPanelModule,
  ContextMenuModule,
  RowGroupingModule,
} from "ag-grid-enterprise";
if (process.env.NODE_ENV !== "production") {
  enableDevValidations();
}

ModuleRegistry.registerModules([
  RowSelectionModule,
  ClientSideRowModelModule,
  ColumnsToolPanelModule,
  ColumnMenuModule,
  ContextMenuModule,
  RowGroupingModule,
]);
import { IOlympicData } from "./interfaces";

@Component({
  selector: "my-app",
  standalone: true,
  imports: [AgGridAngular],
  template: `<ag-grid-angular
    style="width: 100%; height: 100%;"
    [columnDefs]="columnDefs"
    [defaultColDef]="defaultColDef"
    [rowSelection]="rowSelection"
    [rowData]="rowData"
    (gridReady)="onGridReady($event)"
  /> `,
})
export class AppComponent {
  columnDefs: ColDef[] = [
    { field: "athlete", minWidth: 150 },
    { field: "age", maxWidth: 90 },
    { field: "country", minWidth: 150 },
    { field: "year", maxWidth: 90 },
    { field: "date", minWidth: 150 },
    { field: "sport", minWidth: 150 },
    { field: "gold" },
    { field: "silver" },
    { field: "bronze" },
    { field: "total" },
  ];
  defaultColDef: ColDef = {
    flex: 1,
    minWidth: 100,
  };
  rowSelection: RowSelectionOptions | "single" | "multiple" = {
    mode: "multiRow",
  };
  rowData!: IOlympicData[];

  constructor(private http: HttpClient) {}

  onGridReady(params: GridReadyEvent<IOlympicData>) {
    this.http
      .get<
        IOlympicData[]
      >("https://www.ag-grid.com/example-assets/small-olympic-winners.json")
      .subscribe((data) => (this.rowData = data));
  }
}
```

[Live example: Enabling Row Selection](https://www.ag-grid.com/examples/row-selection-multi-row/enabling-row-selection/angular)

Click checkboxes to select or deselect a row. Alternatively, you can do this via the keyboard by focusing the row and pressing the `␣ Space` key. Users can hold `⇧ Shift` and then click a checkbox to add a range of adjacent rows to the selection.

Ranges of rows can be selected by holding down `⇧ Shift` while clicking on checkboxes. This behaviour also applies when [Click Selection](#enable-click-selection--deselection) is enabled, and in [Group Selection](https://www.ag-grid.com/angular-data-grid/grouping-row-selection/).

## Removing Selection Checkboxes

To prevent any row selection checkboxes from being rendered in rows, set `rowSelection.checkboxes` to `false`. To prevent the header checkbox from being rendered, set `rowSelection.headerCheckbox` to `false`. Setting both to `false` will disable the checkbox column. You will also need to enable click selection by setting `enableClickSelection: true`.

```ts
<ag-grid-angular
    [rowSelection]="rowSelection"
    /* other grid options ... */ />

this.rowSelection = {
    mode: 'multiRow',
    checkboxes: false,
    headerCheckbox: false,
    enableClickSelection: true,
};
```

#### Checkbox Selection

```ts
import { Component } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { AgGridAngular } from "ag-grid-angular";
import {
  ClientSideRowModelModule,
  ColDef,
  ColGroupDef,
  GridApi,
  GridOptions,
  GridReadyEvent,
  ModuleRegistry,
  RowSelectionModule,
  RowSelectionOptions,
  enableDevValidations,
} from "ag-grid-community";
import {
  ColumnMenuModule,
  ColumnsToolPanelModule,
  ContextMenuModule,
  RowGroupingModule,
} from "ag-grid-enterprise";
if (process.env.NODE_ENV !== "production") {
  enableDevValidations();
}

ModuleRegistry.registerModules([
  RowSelectionModule,
  ClientSideRowModelModule,
  ColumnsToolPanelModule,
  ColumnMenuModule,
  ContextMenuModule,
  RowGroupingModule,
]);
import { IOlympicData } from "./interfaces";

@Component({
  selector: "my-app",
  standalone: true,
  imports: [AgGridAngular],
  template: `<ag-grid-angular
    style="width: 100%; height: 100%;"
    [columnDefs]="columnDefs"
    [defaultColDef]="defaultColDef"
    [rowSelection]="rowSelection"
    [rowData]="rowData"
    (gridReady)="onGridReady($event)"
  /> `,
})
export class AppComponent {
  columnDefs: ColDef[] = [
    { field: "athlete" },
    { field: "sport" },
    { field: "year", maxWidth: 120 },
  ];
  defaultColDef: ColDef = {
    flex: 1,
    minWidth: 100,
  };
  rowSelection: RowSelectionOptions | "single" | "multiple" = {
    mode: "multiRow",
    checkboxes: false,
    headerCheckbox: false,
    enableClickSelection: true,
  };
  rowData!: IOlympicData[];

  constructor(private http: HttpClient) {}

  onGridReady(params: GridReadyEvent<IOlympicData>) {
    this.http
      .get<
        IOlympicData[]
      >("https://www.ag-grid.com/example-assets/small-olympic-winners.json")
      .subscribe((data) => (this.rowData = data));
  }
}
```

[Live example: Checkbox Selection](https://www.ag-grid.com/examples/row-selection-multi-row/checkbox-selection/angular)

> **Note**
>
> You may pass a function to `rowSelection.checkboxes` to dynamically enable or disable checkboxes for given rows. Unlike the boolean `false`, which removes the checkboxes entirely, a selectable row for which the function returns `false` shows a disabled checkbox rather than removing it.
>
> For rows where both `isRowSelectable` and `rowSelection.checkboxes` return `false`, checkboxes will be hidden, rather than disabled.

## Configure Selectable Rows

It is possible to specify which rows can be selected via the `rowSelection.isRowSelectable` callback function.

For instance if we only wanted to allow selection for rows where the 'year' property is less than 2007, we could implement the following:

```ts
<ag-grid-angular
    [rowSelection]="rowSelection"
    /* other grid options ... */ />

this.rowSelection = {
    mode: 'multiRow',
    isRowSelectable: (rowNode) => rowNode.data ? rowNode.data.year < 2007 : false,
};
```

Rows for which `isRowSelectable` returns `false` cannot be selected at all, whether using the UI or the API.

#### Checkbox Selection: Hiding Disabled Checkboxes

```ts
import { Component } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { AgGridAngular } from "ag-grid-angular";
import "./styles.css";
import {
  ClientSideRowModelModule,
  ColDef,
  ColGroupDef,
  GridApi,
  GridOptions,
  GridReadyEvent,
  ModuleRegistry,
  RowSelectionModule,
  RowSelectionOptions,
  enableDevValidations,
} from "ag-grid-community";
import {
  ColumnMenuModule,
  ColumnsToolPanelModule,
  ContextMenuModule,
  RowGroupingModule,
} from "ag-grid-enterprise";
if (process.env.NODE_ENV !== "production") {
  enableDevValidations();
}

ModuleRegistry.registerModules([
  RowSelectionModule,
  ClientSideRowModelModule,
  ColumnsToolPanelModule,
  ColumnMenuModule,
  ContextMenuModule,
  RowGroupingModule,
]);
import { IOlympicData } from "./interfaces";

@Component({
  selector: "my-app",
  standalone: true,
  imports: [AgGridAngular],
  template: `<div class="example-wrapper">
    <div class="example-header">
      <label>
        <span>Hide disabled checkboxes:</span>
        <input
          id="toggle-hide-checkbox"
          type="checkbox"
          checked=""
          (change)="toggleHideCheckbox()"
        />
      </label>
    </div>
    <ag-grid-angular
      style="width: 100%; height: 100%;"
      [columnDefs]="columnDefs"
      [defaultColDef]="defaultColDef"
      [rowSelection]="rowSelection"
      [rowData]="rowData"
      (gridReady)="onGridReady($event)"
    />
  </div> `,
})
export class AppComponent {
  private gridApi!: GridApi<IOlympicData>;

  columnDefs: ColDef[] = [
    { field: "athlete" },
    { field: "sport" },
    { field: "year", maxWidth: 120 },
  ];
  defaultColDef: ColDef = {
    flex: 1,
    minWidth: 100,
  };
  rowSelection: RowSelectionOptions | "single" | "multiple" = {
    mode: "multiRow",
    hideDisabledCheckboxes: true,
    isRowSelectable: (node) => (node.data ? node.data.year < 2007 : false),
  };
  rowData!: IOlympicData[];

  constructor(private http: HttpClient) {}

  toggleHideCheckbox() {
    this.gridApi.setGridOption("rowSelection", {
      mode: "multiRow",
      isRowSelectable: (node) => (node.data ? node.data.year < 2007 : false),
      hideDisabledCheckboxes: getCheckboxValue("#toggle-hide-checkbox"),
    });
  }

  onGridReady(params: GridReadyEvent<IOlympicData>) {
    this.gridApi = params.api;

    this.http
      .get<
        IOlympicData[]
      >("https://www.ag-grid.com/example-assets/small-olympic-winners.json")
      .subscribe((data) => (this.rowData = data));
  }
}

function getCheckboxValue(id: string): boolean {
  return document.querySelector<HTMLInputElement>(id)?.checked ?? false;
}
```

[Live example: Checkbox Selection: Hiding Disabled Checkboxes](https://www.ag-grid.com/examples/row-selection-multi-row/checkbox-selection-disable-checkboxes/angular)

Note that this example uses `hideDisabledCheckboxes` to hide disabled checkboxes, which can be toggled on or off.

## Selecting All Rows

All rows may be selected at once by using the header checkbox, which is enabled by default in `'multiRow'` mode.

The three possible values of `rowSelection.selectAll` are:

- `'all'`: *(Default)* Selecting the header checkbox selects all [selectable](#configure-selectable-rows) rows in the grid.
- `'filtered'`: Selecting the header checkbox will select all rows that satisfy the currently active filter.
- `'currentPage'`: Selecting the header checkbox will select all rows that satisfy the currently active filter on the current page.

```ts
<ag-grid-angular
    [rowSelection]="rowSelection"
    /* other grid options ... */ />

this.rowSelection = {
    mode: 'multiRow',
    selectAll: 'filtered'
};
```

The example below demonstrates the three different modes available for `rowSelection.selectAll`:

#### Header Checkbox Selection

```ts
import { Component } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { AgGridAngular } from "ag-grid-angular";
import "./styles.css";
import {
  ClientSideRowModelModule,
  ColDef,
  ColGroupDef,
  GridApi,
  GridOptions,
  GridReadyEvent,
  ModuleRegistry,
  PaginationModule,
  QuickFilterModule,
  RowSelectionModule,
  RowSelectionOptions,
  enableDevValidations,
} from "ag-grid-community";
if (process.env.NODE_ENV !== "production") {
  enableDevValidations();
}

ModuleRegistry.registerModules([
  PaginationModule,
  RowSelectionModule,
  QuickFilterModule,
  ClientSideRowModelModule,
]);
import { IOlympicData } from "./interfaces";

@Component({
  selector: "my-app",
  standalone: true,
  imports: [AgGridAngular],
  template: `<div class="example-wrapper">
    <div style="margin-bottom: 10px">
      <label style="margin-right: 10px">
        <span>Select All Mode: </span>
        <select id="select-all-mode" (change)="updateSelectAllMode()">
          <option value="all">all</option>
          <option value="filtered">filtered</option>
          <option value="currentPage">currentPage</option>
        </select>
      </label>
      <label>
        <span>Filter: </span>
        <input
          type="text"
          (input)="onQuickFilterChanged()"
          id="quickFilter"
          placeholder="quick filter..."
        />
      </label>
    </div>
    <ag-grid-angular
      style="width: 100%; height: 100%;"
      [columnDefs]="columnDefs"
      [defaultColDef]="defaultColDef"
      [pagination]="true"
      [paginationAutoPageSize]="true"
      [rowSelection]="rowSelection"
      [rowData]="rowData"
      (gridReady)="onGridReady($event)"
    />
  </div> `,
})
export class AppComponent {
  private gridApi!: GridApi<IOlympicData>;

  columnDefs: ColDef[] = [
    { headerName: "Athlete", field: "athlete", minWidth: 180 },
    { field: "age" },
    { field: "country", minWidth: 150 },
    { field: "year" },
    { field: "date", minWidth: 150 },
    { field: "sport", minWidth: 150 },
    { field: "gold" },
    { field: "silver" },
    { field: "bronze" },
    { field: "total" },
  ];
  defaultColDef: ColDef = {
    flex: 1,
    minWidth: 100,
  };
  rowSelection: RowSelectionOptions | "single" | "multiple" = {
    mode: "multiRow",
    selectAll: "all",
  };
  rowData!: IOlympicData[];

  constructor(private http: HttpClient) {}

  onQuickFilterChanged() {
    this.gridApi.setGridOption(
      "quickFilterText",
      document.querySelector<HTMLInputElement>("#quickFilter")?.value,
    );
  }

  updateSelectAllMode() {
    const selectAll =
      document.querySelector<HTMLSelectElement>("#select-all-mode")?.value ??
      "all";
    this.gridApi.setGridOption("rowSelection", {
      mode: "multiRow",
      selectAll: selectAll as "all" | "filtered" | "currentPage",
    });
  }

  onGridReady(params: GridReadyEvent<IOlympicData>) {
    this.gridApi = params.api;

    this.http
      .get<
        IOlympicData[]
      >("https://www.ag-grid.com/example-assets/small-olympic-winners.json")
      .subscribe((data) => (this.rowData = data));
  }
}
```

[Live example: Header Checkbox Selection](https://www.ag-grid.com/examples/row-selection-multi-row/header-checkbox/angular)

Note that when `rowSelection.isRowSelectable` is defined, the header checkbox will only select selectable rows.

> **Note**
>
> The value of `rowSelection.selectAll` does not affect group selection behaviour, which is controlled by `rowSelection.groupSelects`. See [Row Grouping - Selecting Groups](https://www.ag-grid.com/angular-data-grid/grouping-row-selection/) for more on this.

## Customising the Checkbox Column

The checkbox column may be customised in a similar way to any other column, by specifying its column definition in the `selectionColumnDef` grid option.

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `selectionColumnDef` | `SelectionColumnDef` |  |  | Configure the selection column, used for displaying checkboxes. Note that due to the nature of this column, this type is a subset of `ColDef`, which does not support several normal column features such as editing, pivoting and grouping. |

The `SelectionColumnDef` allows for a great deal of customisation, including custom renderers, sorting, tooltips and more. The example below demonstrates the following configuration:

- allowing sorting using the default sort order (selected first) via the header
- changing the default width of the column
- allowing resizing
- pinning it to the left

```ts
<ag-grid-angular
    [selectionColumnDef]="selectionColumnDef"
    /* other grid options ... */ />

this.selectionColumnDef = {
    sortable: true,
    resizable: true,
    width: 120,
    suppressHeaderMenuButton: false,
    pinned: 'left',
};
```

#### Customising Checkbox Column

```ts
import { Component } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { AgGridAngular } from "ag-grid-angular";
import {
  ClientSideRowModelModule,
  ColDef,
  ColGroupDef,
  GridApi,
  GridOptions,
  GridReadyEvent,
  IRowNode,
  ModuleRegistry,
  RowApiModule,
  RowSelectionModule,
  RowSelectionOptions,
  SelectionColumnDef,
  enableDevValidations,
} from "ag-grid-community";
import {
  ColumnMenuModule,
  ColumnsToolPanelModule,
  ContextMenuModule,
  RowGroupingModule,
} from "ag-grid-enterprise";
if (process.env.NODE_ENV !== "production") {
  enableDevValidations();
}

ModuleRegistry.registerModules([
  RowSelectionModule,
  RowApiModule,
  ClientSideRowModelModule,
  ColumnsToolPanelModule,
  ColumnMenuModule,
  ContextMenuModule,
  RowGroupingModule,
]);
import { IOlympicData } from "./interfaces";

@Component({
  selector: "my-app",
  standalone: true,
  imports: [AgGridAngular],
  template: `<ag-grid-angular
    style="width: 100%; height: 100%;"
    [columnDefs]="columnDefs"
    [defaultColDef]="defaultColDef"
    [rowSelection]="rowSelection"
    [selectionColumnDef]="selectionColumnDef"
    [rowData]="rowData"
    (firstDataRendered)="onFirstDataRendered($event)"
    (gridReady)="onGridReady($event)"
  /> `,
})
export class AppComponent {
  columnDefs: ColDef[] = [
    { field: "athlete", minWidth: 300 },
    { field: "country", minWidth: 200 },
    { field: "sport", minWidth: 200 },
    { field: "year" },
    { field: "date", minWidth: 200 },
  ];
  defaultColDef: ColDef = {
    flex: 1,
    minWidth: 100,
  };
  rowSelection: RowSelectionOptions | "single" | "multiple" = {
    mode: "multiRow",
  };
  selectionColumnDef: SelectionColumnDef = {
    sortable: true,
    resizable: true,
    width: 120,
    suppressHeaderMenuButton: false,
    pinned: "left",
  };
  rowData!: IOlympicData[];

  constructor(private http: HttpClient) {}

  onFirstDataRendered(params) {
    const nodesToSelect: IRowNode[] = [];
    params.api.forEachNode((node) => {
      if (node.rowIndex && node.rowIndex >= 3 && node.rowIndex <= 8) {
        nodesToSelect.push(node);
      }
    });
    params.api.setNodesSelected({ nodes: nodesToSelect, newValue: true });
  }

  onGridReady(params: GridReadyEvent<IOlympicData>) {
    this.http
      .get<
        IOlympicData[]
      >("https://www.ag-grid.com/example-assets/small-olympic-winners.json")
      .subscribe((data) => (this.rowData = data));
  }
}
```

[Live example: Customising Checkbox Column](https://www.ag-grid.com/examples/row-selection-multi-row/customise-checkbox-column/angular)

> **Note**
>
> When sorting by the checkbox column, selecting a new row will not automatically update the row order, see [Change Detection](https://www.ag-grid.com/angular-data-grid/change-detection/#change-detection-and-sorting-filtering-grouping) for more information.

> **Note**
>
> The checkbox column is sized statically, and is therefore not affected by [Auto-Sizing](https://www.ag-grid.com/angular-data-grid/column-sizing/#auto-sizing-columns).

## Enable Click Selection & Deselection

The `rowSelection.enableClickSelection` property configures whether a row's selection state will be impacted when the row is clicked, or when `␣ Space` is pressed while the row is focused.

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `enableClickSelection` | `boolean \| 'enableDeselection' \| 'enableSelection'` |  | `false` | Modifies the selection behaviour when clicking a row. Choosing `'enableSelection'` allows selection of a row by clicking the row itself. Choosing `'enableDeselection'` allows deselection of a row by CTRL-clicking the row itself. Choosing `true` allows both selection of a row by clicking and deselection of a row by CTRL-clicking. Choosing `false` prevents rows from being selected or deselected by clicking. |

This is typically used when [Checkbox Selection](#removing-selection-checkboxes) is disabled, though both can be enabled simultaneously if desired. Click-selection and deselection can be enabled by setting `enableClickSelection` to `true`, otherwise they may be enabled separately using the values `'enableSelection'` and `'enableDeselection'`.

```ts
<ag-grid-angular
    [rowSelection]="rowSelection"
    /* other grid options ... */ />

this.rowSelection = {
    mode: 'multiRow',
    enableClickSelection: true,
};
```

The example below demonstrates the three possible configurations for this property, as well as the behaviour when it is disabled. Use the select element to switch between modes.

#### Disable Click Selection

```ts
import { Component } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { AgGridAngular } from "ag-grid-angular";
import "./styles.css";
import {
  ClientSideRowModelModule,
  ColDef,
  ColGroupDef,
  GridApi,
  GridOptions,
  GridReadyEvent,
  ModuleRegistry,
  RowSelectionModule,
  RowSelectionOptions,
  enableDevValidations,
} from "ag-grid-community";
import {
  ColumnMenuModule,
  ColumnsToolPanelModule,
  ContextMenuModule,
  RowGroupingModule,
} from "ag-grid-enterprise";
if (process.env.NODE_ENV !== "production") {
  enableDevValidations();
}

ModuleRegistry.registerModules([
  RowSelectionModule,
  ClientSideRowModelModule,
  ColumnsToolPanelModule,
  ColumnMenuModule,
  ContextMenuModule,
  RowGroupingModule,
]);
import { IOlympicData } from "./interfaces";

@Component({
  selector: "my-app",
  standalone: true,
  imports: [AgGridAngular],
  template: `<div class="example-wrapper">
    <div class="example-header">
      <label>
        <span>Enable Click Selection: </span>
        <select id="select-enable" (change)="onEnableClickSelection()">
          <option value="true">true</option>
          <option value="enableSelection">enableSelection</option>
          <option value="enableDeselection">enableDeselection</option>
          <option value="false">false</option>
        </select>
      </label>
    </div>
    <ag-grid-angular
      style="width: 100%; height: 100%;"
      [columnDefs]="columnDefs"
      [defaultColDef]="defaultColDef"
      [rowSelection]="rowSelection"
      [rowData]="rowData"
      (gridReady)="onGridReady($event)"
    />
  </div> `,
})
export class AppComponent {
  private gridApi!: GridApi<IOlympicData>;

  columnDefs: ColDef[] = [
    { field: "athlete", minWidth: 150 },
    { field: "age", maxWidth: 90 },
    { field: "country", minWidth: 150 },
    { field: "year", maxWidth: 90 },
    { field: "date", minWidth: 150 },
    { field: "sport", minWidth: 150 },
    { field: "gold" },
    { field: "silver" },
    { field: "bronze" },
    { field: "total" },
  ];
  defaultColDef: ColDef = {
    flex: 1,
    minWidth: 100,
  };
  rowSelection: RowSelectionOptions | "single" | "multiple" = {
    mode: "multiRow",
    enableClickSelection: true,
  };
  rowData!: IOlympicData[];

  constructor(private http: HttpClient) {}

  onEnableClickSelection() {
    const value =
      document.querySelector<HTMLSelectElement>("#select-enable")?.value;
    this.gridApi.setGridOption("rowSelection", {
      mode: "multiRow",
      enableClickSelection:
        value === "true" ? true : value === "false" ? false : (value as any),
    });
  }

  onGridReady(params: GridReadyEvent<IOlympicData>) {
    this.gridApi = params.api;

    this.http
      .get<
        IOlympicData[]
      >("https://www.ag-grid.com/example-assets/small-olympic-winners.json")
      .subscribe((data) => (this.rowData = data));
  }
}
```

[Live example: Disable Click Selection](https://www.ag-grid.com/examples/row-selection-multi-row/suppress-click-selection/angular)

> **Note**
>
> Note that deselection is still possible when checkboxes are enabled by clicking a selected checkbox.

## Force Checkboxes to be Selected

It is possible to select a row via the Grid API and disable its checkbox to prevent users from deselecting it. This can be achieved by providing a function to `rowSelection.checkboxes`.

```ts
<ag-grid-angular
    [rowSelection]="rowSelection"
    [onFirstDataRendered]="onFirstDataRendered"
    /* other grid options ... */ />

this.rowSelection = {
    mode: 'multiRow',
    checkboxes: (params) => params.data && params.data.year === 2012,
};
this.onFirstDataRendered = (params) => {
    const nodesToSelect = [];
    params.api.forEachNode((node) => {
        if (node.data && node.data.year <= 2008 && node.data.year >= 2004) {
            nodesToSelect.push(node);
        }
    });
    params.api.setNodesSelected({ nodes: nodesToSelect, newValue: true });
};
```

In the example below only rows with Year equal to 2012 can be selected or deselected by the user. Clicking the header checkbox, however, will select all rows even if their checkboxes are disabled.

#### Force Checkboxes to be Selected

```ts
import { Component } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { AgGridAngular } from "ag-grid-angular";
import {
  ClientSideRowModelModule,
  ColDef,
  ColGroupDef,
  GridApi,
  GridOptions,
  GridReadyEvent,
  IRowNode,
  ModuleRegistry,
  RowApiModule,
  RowSelectionModule,
  RowSelectionOptions,
  enableDevValidations,
} from "ag-grid-community";
import {
  ColumnMenuModule,
  ColumnsToolPanelModule,
  ContextMenuModule,
  RowGroupingModule,
} from "ag-grid-enterprise";
if (process.env.NODE_ENV !== "production") {
  enableDevValidations();
}

ModuleRegistry.registerModules([
  RowSelectionModule,
  RowApiModule,
  ClientSideRowModelModule,
  ColumnsToolPanelModule,
  ColumnMenuModule,
  ContextMenuModule,
  RowGroupingModule,
]);
import { IOlympicData } from "./interfaces";

@Component({
  selector: "my-app",
  standalone: true,
  imports: [AgGridAngular],
  template: `<ag-grid-angular
    style="width: 100%; height: 100%;"
    [columnDefs]="columnDefs"
    [defaultColDef]="defaultColDef"
    [rowSelection]="rowSelection"
    [rowData]="rowData"
    (firstDataRendered)="onFirstDataRendered($event)"
    (gridReady)="onGridReady($event)"
  /> `,
})
export class AppComponent {
  columnDefs: ColDef[] = [
    { field: "athlete" },
    { field: "sport" },
    { field: "year", maxWidth: 120 },
  ];
  defaultColDef: ColDef = {
    flex: 1,
    minWidth: 100,
  };
  rowSelection: RowSelectionOptions | "single" | "multiple" = {
    mode: "multiRow",
    checkboxes: (params) => params.data?.year === 2012,
  };
  rowData!: IOlympicData[];

  constructor(private http: HttpClient) {}

  onFirstDataRendered(params) {
    const nodesToSelect: IRowNode[] = [];
    params.api.forEachNode((node) => {
      if (node.data && node.data.year <= 2008 && node.data.year >= 2004) {
        nodesToSelect.push(node);
      }
    });
    params.api.setNodesSelected({ nodes: nodesToSelect, newValue: true });
  }

  onGridReady(params: GridReadyEvent<IOlympicData>) {
    this.http
      .get<
        IOlympicData[]
      >("https://www.ag-grid.com/example-assets/small-olympic-winners.json")
      .subscribe((data) => (this.rowData = data));
  }
}
```

[Live example: Force Checkboxes to be Selected](https://www.ag-grid.com/examples/row-selection-multi-row/force-enable-checkboxes/angular)

## Selecting Multiple Rows without Ctrl key

In certain circumstances, especially in the context of touchscreen devices, users may want to select multiple rows without having to use the `^ Ctrl` key.

This can be accomplished by setting the `rowSelection.enableSelectionWithoutKeys` flag to `true`. You will also need to set `enableClickSelection` to `true`.

```ts
<ag-grid-angular
    [rowSelection]="rowSelection"
    /* other grid options ... */ />

this.rowSelection = {
    mode: 'multiRow',
    checkboxes: false,
    headerCheckbox: false,
    enableSelectionWithoutKeys: true,
    enableClickSelection: true,
};
```

Click multiple rows in the example below without pressing any keyboard keys to explore this behaviour.

#### Multi-select without Keyboard modifiers

```ts
import { Component } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { AgGridAngular } from "ag-grid-angular";
import {
  ClientSideRowModelModule,
  ColDef,
  ColGroupDef,
  GridApi,
  GridOptions,
  GridReadyEvent,
  ModuleRegistry,
  RowSelectionModule,
  RowSelectionOptions,
  enableDevValidations,
} from "ag-grid-community";
import {
  ColumnMenuModule,
  ColumnsToolPanelModule,
  ContextMenuModule,
  RowGroupingModule,
} from "ag-grid-enterprise";
if (process.env.NODE_ENV !== "production") {
  enableDevValidations();
}

ModuleRegistry.registerModules([
  RowSelectionModule,
  ClientSideRowModelModule,
  ColumnsToolPanelModule,
  ColumnMenuModule,
  ContextMenuModule,
  RowGroupingModule,
]);
import { IOlympicData } from "./interfaces";

@Component({
  selector: "my-app",
  standalone: true,
  imports: [AgGridAngular],
  template: `<ag-grid-angular
    style="width: 100%; height: 100%;"
    [columnDefs]="columnDefs"
    [defaultColDef]="defaultColDef"
    [rowSelection]="rowSelection"
    [rowData]="rowData"
    (gridReady)="onGridReady($event)"
  /> `,
})
export class AppComponent {
  columnDefs: ColDef[] = [
    { field: "athlete" },
    { field: "sport" },
    { field: "year", maxWidth: 120 },
  ];
  defaultColDef: ColDef = { flex: 1, minWidth: 100 };
  rowSelection: RowSelectionOptions | "single" | "multiple" = {
    mode: "multiRow",
    enableSelectionWithoutKeys: true,
    enableClickSelection: true,
    checkboxes: false,
    headerCheckbox: false,
  };
  rowData!: IOlympicData[];

  constructor(private http: HttpClient) {}

  onGridReady(params: GridReadyEvent<IOlympicData>) {
    this.http
      .get<
        IOlympicData[]
      >("https://www.ag-grid.com/example-assets/small-olympic-winners.json")
      .subscribe((data) => (this.rowData = data));
  }
}
```

[Live example: Multi-select without Keyboard modifiers](https://www.ag-grid.com/examples/row-selection-multi-row/multi-select-with-click/angular)

## API Reference

See the full list of configuration options available in `'multiRow'` mode.

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `mode` | `'multiRow'` |  |  | 'multiRow' |
| `groupSelects` | `GroupSelectionMode` |  | `'self'` | Determine group selection behaviour |
| `selectAll` | `SelectAllMode` |  | `'all'` | Determines how "select all" behaviour works. This controls header checkbox selection. |
| `headerCheckbox` | `boolean` |  | `true` | If `true` a 'select all' checkbox will be put into the header. |
| `ctrlASelectsRows` | `boolean` |  | `false` | If `true`, using CTRL+A will select all rows when [Cell Selection](https://www.ag-grid.com/angular-data-grid/cell-selection/) is enabled |
| `enableClickSelection` | `boolean \| 'enableDeselection' \| 'enableSelection'` |  | `false` | Modifies the selection behaviour when clicking a row. Choosing `'enableSelection'` allows selection of a row by clicking the row itself. Choosing `'enableDeselection'` allows deselection of a row by CTRL-clicking the row itself. Choosing `true` allows both selection of a row by clicking and deselection of a row by CTRL-clicking. Choosing `false` prevents rows from being selected or deselected by clicking. |
| `checkboxes` | `boolean \| CheckboxSelectionCallback` |  | `true` | Set to `true` or return `true` from the callback to render a selection checkbox. |
| `checkboxLocation` | `CheckboxLocation` |  | `'selectionColumn'` | Configure where checkboxes are displayed. Choosing `'selectionColumn'` displays checkboxes in a dedicated selection column. Choosing `'autoGroupColumn'` displays checkboxes in the autoGroupColumn. This applies to row checkboxes and header checkboxes. |
| `hideDisabledCheckboxes` | `boolean` |  | `false` | Set to `true` to hide a disabled checkbox when row is not selectable and checkboxes are enabled. |
| `isRowSelectable` | `IsRowSelectable` |  |  | Callback to be used to determine which rows are selectable. By default rows are selectable, so return `false` to make a row non-selectable. |
| `copySelectedRows` | `boolean` |  | `false` | When enabled and a row is selected, the copy action should copy the entire row, rather than just the focused cell |
| `enableSelectionWithoutKeys` | `boolean` |  | `false` | Set to `true` to allow (possibly multiple) rows to be selected and deselected using single click or touch. |
| `masterSelects` | `'self' \| 'detail'` |  | `'self'` | Determines the selection behaviour of master rows with respect to their detail cells. When set to `'self'`, selecting the master row has no effect on the selection state of the detail row. When set to `'detail'`, selecting the master row behaves the same as the header checkbox of the detail grid. |

## Row Selection with Enterprise Features

Row selection can be used when using row grouping, tree data and the server-side row model. See the respective sections of the documentation:

- [Row Group Selection](https://www.ag-grid.com/angular-data-grid/grouping-row-selection/)
- [Tree Data Selection](https://www.ag-grid.com/angular-data-grid/tree-data-selection/)
- [Server-Side Row Model Selection](https://www.ag-grid.com/angular-data-grid/server-side-model-selection/)
