---
title: "Row Numbers"
enterprise: true
framework: vue
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/vue-data-grid/modules/). |

```ts
<ag-grid-vue
    :rowNumbers="rowNumbers"
    /* other grid options ... */>
</ag-grid-vue>

this.rowNumbers = true;
```

#### Row Numbers

```ts
import {
  createApp,
  defineComponent,
  onBeforeMount,
  ref,
  shallowRef,
} from "vue";
import { AgGridVue } from "ag-grid-vue3";
import {
  ClientSideRowModelModule,
  ColDef,
  ColGroupDef,
  GridApi,
  GridOptions,
  GridReadyEvent,
  ModuleRegistry,
  RowNumbersOptions,
  enableDevValidations,
} from "ag-grid-community";
import { RowNumbersModule } from "ag-grid-enterprise";
import { IOlympicData } from "./interfaces";
if (process.env.NODE_ENV !== "production") {
  enableDevValidations();
}

ModuleRegistry.registerModules([ClientSideRowModelModule, RowNumbersModule]);

const VueExample = defineComponent({
  template: `
        <div style="height: 100%">
                <ag-grid-vue
      style="width: 100%; height: 100%;"
      @grid-ready="onGridReady"
      :columnDefs="columnDefs"
      :defaultColDef="defaultColDef"
      :rowNumbers="true"
      :rowData="rowData"></ag-grid-vue>
        </div>
    `,
  components: {
    "ag-grid-vue": AgGridVue,
  },
  setup(props) {
    const gridApi = shallowRef<GridApi<IOlympicData> | null>(null);
    const columnDefs = ref<ColDef[]>([
      { field: "athlete" },
      { field: "country" },
      { field: "sport" },
      { field: "year" },
      { field: "gold" },
      { field: "silver" },
      { field: "bronze" },
    ]);
    const defaultColDef = ref<ColDef>({
      flex: 1,
      minWidth: 100,
    });
    const rowData = ref<IOlympicData[]>(null);

    const onGridReady = (params: GridReadyEvent) => {
      gridApi.value = params.api;

      const updateData = (data) => {
        rowData.value = data;
      };

      fetch("https://www.ag-grid.com/example-assets/olympic-winners.json")
        .then((resp) => resp.json())
        .then((data) => updateData(data));
    };

    return {
      gridApi,
      columnDefs,
      defaultColDef,
      rowData,
      onGridReady,
    };
  },
});

const app = createApp(VueExample);
app.mount("#app");
```

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

## Cell Selection

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

```ts
<ag-grid-vue
    :rowNumbers="rowNumbers"
    :cellSelection="cellSelection"
    /* other grid options ... */>
</ag-grid-vue>

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

#### Row Numbers with Cell Selection

```ts
import {
  createApp,
  defineComponent,
  onBeforeMount,
  ref,
  shallowRef,
} from "vue";
import { AgGridVue } from "ag-grid-vue3";
import {
  CellSelectionOptions,
  ClientSideRowModelModule,
  ColDef,
  ColGroupDef,
  GridApi,
  GridOptions,
  GridReadyEvent,
  ModuleRegistry,
  RowNumbersOptions,
  enableDevValidations,
} from "ag-grid-community";
import { CellSelectionModule, RowNumbersModule } from "ag-grid-enterprise";
import { IOlympicData } from "./interfaces";
if (process.env.NODE_ENV !== "production") {
  enableDevValidations();
}

ModuleRegistry.registerModules([
  ClientSideRowModelModule,
  RowNumbersModule,
  CellSelectionModule,
]);

const VueExample = defineComponent({
  template: `
        <div style="height: 100%">
                <ag-grid-vue
      style="width: 100%; height: 100%;"
      @grid-ready="onGridReady"
      :columnDefs="columnDefs"
      :defaultColDef="defaultColDef"
      :cellSelection="true"
      :rowNumbers="true"
      :rowData="rowData"></ag-grid-vue>
        </div>
    `,
  components: {
    "ag-grid-vue": AgGridVue,
  },
  setup(props) {
    const gridApi = shallowRef<GridApi<IOlympicData> | null>(null);
    const columnDefs = ref<ColDef[]>([
      { field: "athlete" },
      { field: "country" },
      { field: "sport" },
      { field: "year" },
      { field: "gold" },
      { field: "silver" },
      { field: "bronze" },
    ]);
    const defaultColDef = ref<ColDef>({
      flex: 1,
      minWidth: 100,
    });
    const rowData = ref<IOlympicData[]>(null);

    const onGridReady = (params: GridReadyEvent) => {
      gridApi.value = params.api;

      const updateData = (data) => {
        rowData.value = data;
      };

      fetch("https://www.ag-grid.com/example-assets/olympic-winners.json")
        .then((resp) => resp.json())
        .then((data) => updateData(data));
    };

    return {
      gridApi,
      columnDefs,
      defaultColDef,
      rowData,
      onGridReady,
    };
  },
});

const app = createApp(VueExample);
app.mount("#app");
```

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

### 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-vue
    :rowNumbers="rowNumbers"
    :cellSelection="cellSelection"
    /* other grid options ... */>
</ag-grid-vue>

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-vue
    :rowNumbers="rowNumbers"
    /* other grid options ... */>
</ag-grid-vue>

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 {
  createApp,
  defineComponent,
  onBeforeMount,
  ref,
  shallowRef,
} from "vue";
import { AgGridVue } from "ag-grid-vue3";
import {
  ClientSideRowModelModule,
  ColDef,
  ColGroupDef,
  GridApi,
  GridOptions,
  GridReadyEvent,
  ModuleRegistry,
  RowNumbersOptions,
  enableDevValidations,
} from "ag-grid-community";
import { RowNumbersModule } from "ag-grid-enterprise";
import { IOlympicData } from "./interfaces";
if (process.env.NODE_ENV !== "production") {
  enableDevValidations();
}

ModuleRegistry.registerModules([ClientSideRowModelModule, RowNumbersModule]);

const VueExample = defineComponent({
  template: `
        <div style="height: 100%">
                <ag-grid-vue
      style="width: 100%; height: 100%;"
      @grid-ready="onGridReady"
      :columnDefs="columnDefs"
      :defaultColDef="defaultColDef"
      :rowNumbers="rowNumbers"
      :rowData="rowData"></ag-grid-vue>
        </div>
    `,
  components: {
    "ag-grid-vue": AgGridVue,
  },
  setup(props) {
    const gridApi = shallowRef<GridApi<IOlympicData> | null>(null);
    const columnDefs = ref<ColDef[]>([
      { field: "athlete" },
      { field: "country" },
      { field: "sport" },
      { field: "year" },
      { field: "gold" },
      { field: "silver" },
      { field: "bronze" },
    ]);
    const defaultColDef = ref<ColDef>({
      flex: 1,
      minWidth: 100,
    });
    const rowNumbers = ref<boolean | RowNumbersOptions>({
      enableRowResizer: true,
    });
    const rowData = ref<IOlympicData[]>(null);

    const onGridReady = (params: GridReadyEvent) => {
      gridApi.value = params.api;

      const updateData = (data) => {
        rowData.value = data;
      };

      fetch("https://www.ag-grid.com/example-assets/olympic-winners.json")
        .then((resp) => resp.json())
        .then((data) => updateData(data));
    };

    return {
      gridApi,
      columnDefs,
      defaultColDef,
      rowNumbers,
      rowData,
      onGridReady,
    };
  },
});

const app = createApp(VueExample);
app.mount("#app");
```

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

> **Note**
>
> The Row Resizer feature does not work when columns are configured with [Auto Row Height](https://www.ag-grid.com/vue-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/vue-data-grid/csv-export/) or [Excel Export](https://www.ag-grid.com/vue-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-vue
    :rowNumbers="rowNumbers"
    :cellSelection="cellSelection"
    :defaultCsvExportParams="defaultCsvExportParams"
    :defaultExcelExportParams="defaultExcelExportParams"
    /* other grid options ... */>
</ag-grid-vue>

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 {
  createApp,
  defineComponent,
  onBeforeMount,
  ref,
  shallowRef,
} from "vue";
import { AgGridVue } from "ag-grid-vue3";
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";
import { IOlympicData } from "./interfaces";
if (process.env.NODE_ENV !== "production") {
  enableDevValidations();
}

ModuleRegistry.registerModules([
  ClientSideRowModelModule,
  RowNumbersModule,
  CellSelectionModule,
  ExcelExportModule,
  CsvExportModule,
  ContextMenuModule,
]);

const VueExample = defineComponent({
  template: `
        <div style="height: 100%">
                <ag-grid-vue
      style="width: 100%; height: 100%;"
      @grid-ready="onGridReady"
      :columnDefs="columnDefs"
      :defaultColDef="defaultColDef"
      :rowNumbers="true"
      :defaultCsvExportParams="defaultCsvExportParams"
      :defaultExcelExportParams="defaultExcelExportParams"
      :cellSelection="cellSelection"
      :rowData="rowData"></ag-grid-vue>
        </div>
    `,
  components: {
    "ag-grid-vue": AgGridVue,
  },
  setup(props) {
    const gridApi = shallowRef<GridApi<IOlympicData> | null>(null);
    const columnDefs = ref<ColDef[]>([
      { field: "athlete" },
      { field: "country" },
      { field: "sport" },
      { field: "year" },
      { field: "gold" },
      { field: "silver" },
      { field: "bronze" },
    ]);
    const defaultColDef = ref<ColDef>({
      flex: 1,
      minWidth: 100,
    });
    const defaultCsvExportParams = ref<CsvExportParams>({
      exportRowNumbers: true,
    });
    const defaultExcelExportParams = ref<ExcelExportParams>({
      exportRowNumbers: true,
    });
    const cellSelection = ref<boolean | CellSelectionOptions>({
      enableHeaderHighlight: true,
      handle: {
        mode: "fill",
      },
    });
    const rowData = ref<IOlympicData[]>(null);

    const onGridReady = (params: GridReadyEvent) => {
      gridApi.value = params.api;

      const updateData = (data) => {
        rowData.value = data;
      };

      fetch("https://www.ag-grid.com/example-assets/olympic-winners.json")
        .then((resp) => resp.json())
        .then((data) => updateData(data));
    };

    return {
      gridApi,
      columnDefs,
      defaultColDef,
      defaultCsvExportParams,
      defaultExcelExportParams,
      cellSelection,
      rowData,
      onGridReady,
    };
  },
});

const app = createApp(VueExample);
app.mount("#app");
```

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

## 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/vue-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/vue-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/vue-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/vue-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. |
