---
title: "Row Numbers"
enterprise: true
framework: angular
version: "36.1.0"
---

# Row Numbers

The Row Numbers Feature adds a Column that is always present at the start of the grid where each cell of this column will work as a row header. The following example demonstrates the grid with Row Numbers and no additional configuration.

To enable Row Numbers, set the grid option `rowNumbers = true`.

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `rowNumbers` | `boolean \| RowNumbersOptions` |  | `false` | Configure the Row Numbers Feature. Module: [`RowNumbersModule`](https://www.ag-grid.com/angular-data-grid/modules/). |

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

this.rowNumbers = true;
```

#### Row Numbers

```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,
  RowNumbersOptions,
  enableDevValidations,
} from "ag-grid-community";
import { RowNumbersModule } from "ag-grid-enterprise";
if (process.env.NODE_ENV !== "production") {
  enableDevValidations();
}

ModuleRegistry.registerModules([ClientSideRowModelModule, RowNumbersModule]);
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"
    [rowNumbers]="true"
    [rowData]="rowData"
    (gridReady)="onGridReady($event)"
  /> `,
})
export class AppComponent {
  columnDefs: ColDef[] = [
    { field: "athlete" },
    { field: "country" },
    { field: "sport" },
    { field: "year" },
    { field: "gold" },
    { field: "silver" },
    { field: "bronze" },
  ];
  defaultColDef: ColDef = {
    flex: 1,
    minWidth: 100,
  };
  rowData!: IOlympicData[];

  constructor(private http: HttpClient) {}

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

[Live example: Row Numbers](https://www.ag-grid.com/examples/row-numbers/row-numbers-default/angular)

## Cell Selection

When the grid is configured with [Cell Selection](https://www.ag-grid.com/angular-data-grid/cell-selection/), clicking a Row Number will select all the currently visible cells in the row.

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

this.rowNumbers = true;
this.cellSelection = true;
```

#### Row Numbers with Cell Selection

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

ModuleRegistry.registerModules([
  ClientSideRowModelModule,
  RowNumbersModule,
  CellSelectionModule,
]);
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"
    [cellSelection]="true"
    [rowNumbers]="true"
    [rowData]="rowData"
    (gridReady)="onGridReady($event)"
  /> `,
})
export class AppComponent {
  columnDefs: ColDef[] = [
    { field: "athlete" },
    { field: "country" },
    { field: "sport" },
    { field: "year" },
    { field: "gold" },
    { field: "silver" },
    { field: "bronze" },
  ];
  defaultColDef: ColDef = {
    flex: 1,
    minWidth: 100,
  };
  rowData!: IOlympicData[];

  constructor(private http: HttpClient) {}

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

[Live example: Row Numbers with Cell Selection](https://www.ag-grid.com/examples/row-numbers/row-numbers-cell-selection/angular)

### Suppressing Integration

By default, clicking a row number selects a cell range including all the cells in the row. To prevent this behaviour use the `suppressCellSelectionIntegration` option.

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

this.rowNumbers = {
    suppressCellSelectionIntegration: true
};
this.cellSelection = true;
```

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `suppressCellSelectionIntegration` | `boolean` |  | `false` | Set to `true` to prevent selecting all the currently visible cells in the row when clicking a Row Number. |

## Row Resizing

To allow the Row Numbers feature to resize rows, the `enableRowResizer` property can be used.

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

this.rowNumbers = {
    enableRowResizer: true
};
```

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `enableRowResizer` | `boolean` |  | `false` | Set to `true` to add a resizer to each Row Number cell that allows row resizing. |

#### Row Numbers Row Resizer

```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,
  RowNumbersOptions,
  enableDevValidations,
} from "ag-grid-community";
import { RowNumbersModule } from "ag-grid-enterprise";
if (process.env.NODE_ENV !== "production") {
  enableDevValidations();
}

ModuleRegistry.registerModules([ClientSideRowModelModule, RowNumbersModule]);
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"
    [rowNumbers]="rowNumbers"
    [rowData]="rowData"
    (gridReady)="onGridReady($event)"
  /> `,
})
export class AppComponent {
  columnDefs: ColDef[] = [
    { field: "athlete" },
    { field: "country" },
    { field: "sport" },
    { field: "year" },
    { field: "gold" },
    { field: "silver" },
    { field: "bronze" },
  ];
  defaultColDef: ColDef = {
    flex: 1,
    minWidth: 100,
  };
  rowNumbers: boolean | RowNumbersOptions = {
    enableRowResizer: true,
  };
  rowData!: IOlympicData[];

  constructor(private http: HttpClient) {}

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

[Live example: Row Numbers Row Resizer](https://www.ag-grid.com/examples/row-numbers/row-numbers-row-resizer/angular)

> **Note**
>
> The Row Resizer feature does not work when columns are configured with [Auto Row Height](https://www.ag-grid.com/angular-data-grid/row-height/#auto-row-height).

### Row Resize Events

The following events are fired when a row resize operation starts and ends.

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `rowResizeStarted` | `RowResizeStartedEvent` |  |  | The row resize has started (Row Numbers Feature) |
| `rowResizeEnded` | `RowResizeEndedEvent` |  |  | The row resize has ended (Row Numbers Feature) |

## Value Export

By default, when working with exporters such as [CSV Export](https://www.ag-grid.com/angular-data-grid/csv-export/) or [Excel Export](https://www.ag-grid.com/angular-data-grid/excel-export/), the value of the Row Numbers column is not exported. This behaviour can be changed by toggling the `exportRowNumbers` of the export params.

```ts
<ag-grid-angular
    [rowNumbers]="rowNumbers"
    [cellSelection]="cellSelection"
    [defaultCsvExportParams]="defaultCsvExportParams"
    [defaultExcelExportParams]="defaultExcelExportParams"
    /* other grid options ... */ />

this.rowNumbers = true;
this.cellSelection = {
    enableHeaderHighlight: true,
    handle: { mode: 'fill' },
};
this.defaultCsvExportParams = {
    exportRowNumbers: true,
};
this.defaultExcelExportParams = {
    exportRowNumbers: true,
};
```

### ExportParams

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `exportRowNumbers` | `boolean` |  |  | Set to `true` to allow the contents of the Row Numbers column to be exported. |

#### Row Numbers with Export

```ts
import { Component } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { AgGridAngular } from "ag-grid-angular";
import {
  CellSelectionOptions,
  ClientSideRowModelModule,
  ColDef,
  ColGroupDef,
  CsvExportModule,
  CsvExportParams,
  ExcelExportParams,
  GridApi,
  GridOptions,
  GridReadyEvent,
  ModuleRegistry,
  RowNumbersOptions,
  enableDevValidations,
} from "ag-grid-community";
import {
  CellSelectionModule,
  ContextMenuModule,
  ExcelExportModule,
  RowNumbersModule,
} from "ag-grid-enterprise";
if (process.env.NODE_ENV !== "production") {
  enableDevValidations();
}

ModuleRegistry.registerModules([
  ClientSideRowModelModule,
  RowNumbersModule,
  CellSelectionModule,
  ExcelExportModule,
  CsvExportModule,
  ContextMenuModule,
]);
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"
    [rowNumbers]="true"
    [defaultCsvExportParams]="defaultCsvExportParams"
    [defaultExcelExportParams]="defaultExcelExportParams"
    [cellSelection]="cellSelection"
    [rowData]="rowData"
    (gridReady)="onGridReady($event)"
  /> `,
})
export class AppComponent {
  columnDefs: ColDef[] = [
    { field: "athlete" },
    { field: "country" },
    { field: "sport" },
    { field: "year" },
    { field: "gold" },
    { field: "silver" },
    { field: "bronze" },
  ];
  defaultColDef: ColDef = {
    flex: 1,
    minWidth: 100,
  };
  defaultCsvExportParams: CsvExportParams = {
    exportRowNumbers: true,
  };
  defaultExcelExportParams: ExcelExportParams = {
    exportRowNumbers: true,
  };
  cellSelection: boolean | CellSelectionOptions = {
    enableHeaderHighlight: true,
    handle: {
      mode: "fill",
    },
  };
  rowData!: IOlympicData[];

  constructor(private http: HttpClient) {}

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

[Live example: Row Numbers with Export](https://www.ag-grid.com/examples/row-numbers/row-numbers-export/angular)

## Customising Row Numbers

Row Numbers can be customised by providing a `RowNumbersOptions` object to the `rowNumbers` grid option:

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `suppressCellSelectionIntegration` | `boolean` |  | `false` | Set to `true` to prevent selecting all the currently visible cells in the row when clicking a Row Number. |
| `enableRowResizer` | `boolean` |  | `false` | Set to `true` to add a resizer to each Row Number cell that allows row resizing. |
| `minWidth` | `number` |  | `60` | The minimum width for the row number column. |
| `width` | `number` |  | `60` | The default width for the row number column. |
| `resizable` | `boolean` |  | `false` | Whether this column is resizable. |
| `contextMenuItems` | `(DefaultMenuItem \| MenuItemDef)[] \| GetContextMenuItems` |  |  | Customise the list of menu items available in the context menu. @agModule `ContextMenuModule` Module: [`ContextMenuModule`](https://www.ag-grid.com/angular-data-grid/modules/). |
| `onCellClicked` | `Function` |  |  | Callback called when a cell is clicked. |
| `onCellContextMenu` | `Function` |  |  | Callback called when a cell is right clicked. |
| `onCellDoubleClicked` | `Function` |  |  | Callback called when a cell is double clicked. |
| `headerComponent` | `any` |  |  | The custom header component to be used for rendering the component header. If none specified the default AG Grid header component is used. See [Header Component](https://www.ag-grid.com/javascript-data-grid/column-headers/) for framework specific implementation detail. |
| `headerComponentParams` | `any` |  |  | The parameters to be passed to the `headerComponent`. |
| `suppressNavigable` | `boolean \| SuppressNavigableCallback` |  | `false` | Set to `true` if this column is not navigable (i.e. cannot be tabbed into), otherwise `false`. Can also be a callback function to have different rows navigable. |
| `tooltipField` | `ColDefField` |  |  | The field of the tooltip to apply to the cell. When the column is grouped, group rows in the generated group column inherit this value. @agModule `TooltipModule` Module: [`TooltipModule`](https://www.ag-grid.com/angular-data-grid/modules/). |
| `tooltipValueGetter` | `TooltipValueGetterFunc` |  |  | Callback that should return the string to use for a tooltip, `tooltipField` takes precedence if set. If using a custom `tooltipComponent` you may return any custom value to be passed to your tooltip component. When the column is grouped, group rows in the generated group column inherit this callback. @agModule `TooltipModule` Module: [`TooltipModule`](https://www.ag-grid.com/angular-data-grid/modules/). |
| `tooltipComponentSelector` | `TooltipComponentSelectorFunc` |  |  | Callback to select which tooltip component to be used for a given row within the same column. @agModule `TooltipModule` Module: [`TooltipModule`](https://www.ag-grid.com/angular-data-grid/modules/). |
| `valueGetter` | `string \| ValueGetterFunc` |  |  | Function or expression. Gets the value from your data for display. |
| `valueFormatter` | `string \| ValueFormatterFunc` |  |  | A function or expression to format a value, should return a string. |
| `maxWidth` | `number` |  |  | Maximum width in pixels for the cell. |
| `cellRenderer` | `any` |  |  | Provide your own cell Renderer component for this column's cells. See [Cell Renderer](https://www.ag-grid.com/javascript-data-grid/component-cell-renderer/) for framework specific implementation details. |
| `cellRendererSelector` | `CellRendererSelectorFunc` |  |  | Callback to select which cell renderer to be used for a given row within the same column. |
| `cellRendererParams` | `any` |  |  | Params to be passed to the `cellRenderer` component. |
