---
title: "Row Grouping - Row Group Panel"
enterprise: true
framework: vue
version: "36.1.0"
---

# Row Grouping - Row Group Panel

Use the Row Group Panel to enable users to modify the configured row group columns.

#### Enabling Row Group Panel

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

ModuleRegistry.registerModules([
  ClientSideRowModelModule,
  RowGroupingModule,
  RowGroupingPanelModule,
]);

const VueExample = defineComponent({
  template: `
        <div style="height: 100%">
                <ag-grid-vue
      style="width: 100%; height: 100%;"
      @grid-ready="onGridReady"
      :columnDefs="columnDefs"
      :defaultColDef="defaultColDef"
      :autoGroupColumnDef="autoGroupColumnDef"
      :rowGroupPanelShow="rowGroupPanelShow"
      :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: "country", rowGroup: true, enableRowGroup: true, hide: true },
      { field: "year", rowGroup: true, enableRowGroup: true, hide: true },
      { field: "sport", enableRowGroup: true },
      { field: "total" },
    ]);
    const defaultColDef = ref<ColDef>({
      flex: 1,
      minWidth: 100,
    });
    const autoGroupColumnDef = ref<AutoGroupColumnDef>({
      minWidth: 200,
    });
    const rowGroupPanelShow = ref<"always" | "onlyWhenGrouping" | "never">(
      "always",
    );
    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,
      autoGroupColumnDef,
      rowGroupPanelShow,
      rowData,
      onGridReady,
    };
  },
});

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

[Live example: Enabling Row Group Panel](https://www.ag-grid.com/examples/grouping-group-panel/row-group-panel/vue3)

## Enabling the Row Group Panel

The Row Group Panel allows users to modify which columns are grouped by using drag and drop. The panel can be enabled by setting the `rowGroupPanelShow` grid option to `"always"` or `"onlyWhenGrouping"`.

Columns also need to have `enableRowGroup` set to `true` in their column definition to be dragged into the panel.

The example above enables the panel and configures the `country` and `year` columns to be controllable by the panel:

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

this.columnDefs = [
    { field: 'country', rowGroup: true, enableRowGroup: true },
    { field: 'year', rowGroup: true, enableRowGroup: true },
    // ...other column definitions
];
// possible options: 'never', 'always', 'onlyWhenGrouping'
this.rowGroupPanelShow = 'always';
```

## Row Group Panel in the Side Bar

The Row Group Panel is also displayed as part of the [Columns Tool Panel](https://www.ag-grid.com/vue-data-grid/tool-panel-columns/) in the [Side Bar](https://www.ag-grid.com/vue-data-grid/side-bar/).

#### Side Bar Row Group Panel

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

ModuleRegistry.registerModules([
  ClientSideRowModelModule,
  RowGroupingModule,
  ColumnsToolPanelModule,
]);

const VueExample = defineComponent({
  template: `
        <div style="height: 100%">
                <ag-grid-vue
      style="width: 100%; height: 100%;"
      @grid-ready="onGridReady"
      :columnDefs="columnDefs"
      :defaultColDef="defaultColDef"
      :autoGroupColumnDef="autoGroupColumnDef"
      :sideBar="sideBar"
      :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: "country", enableRowGroup: true, rowGroup: true, hide: true },
      { field: "year", enableRowGroup: true, rowGroup: true, hide: true },
      { field: "athlete", minWidth: 180 },
      { field: "total", enableValue: true, aggFunc: "sum" },
    ]);
    const defaultColDef = ref<ColDef>({
      flex: 1,
      minWidth: 150,
    });
    const autoGroupColumnDef = ref<AutoGroupColumnDef>({
      minWidth: 200,
    });
    const sideBar = ref<SideBarDef | string | string[] | boolean | null>(
      "columns",
    );
    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,
      autoGroupColumnDef,
      sideBar,
      rowData,
      onGridReady,
    };
  },
});

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

[Live example: Side Bar Row Group Panel](https://www.ag-grid.com/examples/grouping-group-panel/side-bar-row-group-panel/vue3)

The example above enabled the [Columns Tool Panel](https://www.ag-grid.com/vue-data-grid/tool-panel-columns/) using the following configuration:

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

this.sideBar = 'columns';
```

Refer to the [Side Bar](https://www.ag-grid.com/vue-data-grid/side-bar/) documentation for further configuration options.

## Row Group Panel in the Toolbar

The Row Group Panel can be embedded in the [Quick Access Toolbar](https://www.ag-grid.com/vue-data-grid/toolbar/#row-group-and-pivot-panels) using the `agRowGroupPanelToolbarItem` built-in item, configured independently of `rowGroupPanelShow`.

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

this.toolbar = {
    items: ['agRowGroupPanelToolbarItem'],
};
```

## Prevent User Grouping from Hiding Columns

After a user applies row grouping to a column, the column is hidden. If the user removes the row grouping, the column is made visible again.

This behaviour can be configured by setting the `suppressGroupChangesColumnVisibility` grid option property to `true`, `"suppressHideOnGroup"` or `"suppressShowOnUngroup"`.

#### Keep Columns Visible

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

ModuleRegistry.registerModules([
  ClientSideRowModelModule,
  RowGroupingModule,
  RowGroupingPanelModule,
]);

const VueExample = defineComponent({
  template: `
        <div style="height: 100%">
                <div class="example-wrapper">
      <div class="example-header">
        <label>
          <span>suppressGroupChangesColumnVisibility:</span>
          <select id="visibility-behaviour" v-on:change="onPropertyChange()">
            <option value="false">false</option>
            <option value="true">true</option>
            <option value="suppressHideOnGroup">"suppressHideOnGroup"</option>
            <option value="suppressShowOnUngroup">"suppressShowOnUngroup"</option>
          </select>
        </label>
        <button v-on:click="resetCols()">Reset Column Visibility</button>
      </div>
      <ag-grid-vue
        style="width: 100%; height: 100%;"
        @grid-ready="onGridReady"
        :columnDefs="columnDefs"
        :defaultColDef="defaultColDef"
        :autoGroupColumnDef="autoGroupColumnDef"
        :suppressDragLeaveHidesColumns="true"
        :rowGroupPanelShow="rowGroupPanelShow"
        :rowData="rowData"></ag-grid-vue>
      </div>
        </div>
    `,
  components: {
    "ag-grid-vue": AgGridVue,
  },
  setup(props) {
    const gridApi = shallowRef<GridApi<IOlympicData> | null>(null);
    const columnDefs = ref<ColDef[]>([
      { field: "country", enableRowGroup: true },
      { field: "year", enableRowGroup: true },
      { field: "athlete", minWidth: 180 },
      { field: "total" },
    ]);
    const defaultColDef = ref<ColDef>({
      flex: 1,
      minWidth: 150,
    });
    const autoGroupColumnDef = ref<AutoGroupColumnDef>({
      minWidth: 200,
    });
    const rowGroupPanelShow = ref<"always" | "onlyWhenGrouping" | "never">(
      "always",
    );
    const rowData = ref<IOlympicData[]>(null);

    function onPropertyChange() {
      const prop = (
        document.querySelector("#visibility-behaviour") as HTMLSelectElement
      ).value;
      if (prop === "true" || prop === "false") {
        gridApi.value!.setGridOption(
          "suppressGroupChangesColumnVisibility",
          prop === "true",
        );
      } else {
        gridApi.value!.setGridOption(
          "suppressGroupChangesColumnVisibility",
          prop as "suppressHideOnGroup" | "suppressShowOnUngroup",
        );
      }
    }
    function resetCols() {
      gridApi.value!.setGridOption("columnDefs", [
        { field: "country", enableRowGroup: true, hide: false },
        { field: "year", enableRowGroup: true, hide: false },
        { field: "athlete", minWidth: 180, hide: false },
        { field: "total", hide: false },
      ]);
    }
    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,
      autoGroupColumnDef,
      rowGroupPanelShow,
      rowData,
      onGridReady,
      onPropertyChange,
      resetCols,
    };
  },
});

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

[Live example: Keep Columns Visible](https://www.ag-grid.com/examples/grouping-group-panel/keep-columns-visible/vue3)

> **Note**
>
> When dragging a column over the row group panel, the column is considered outside of the grid and so will be hidden. This behaviour can be prevented by setting `suppressDragLeaveHidesColumns` to `true`.

The following configuration can be used to prevent the column visibility from being impacted when a user changes the row group columns:

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

this.suppressGroupChangesColumnVisibility = true;
// prevent columns from being hidden when dragged over the row group panel
this.suppressDragLeaveHidesColumns = true;
```

## Prevent Sorting

The panel displays sort indicators, and the column pills can be clicked to change their sort. This behaviour can be prevented by setting the `rowGroupPanelSuppressSort` property to `true`.

#### Prevent Panel Sorting

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

ModuleRegistry.registerModules([
  ClientSideRowModelModule,
  RowGroupingModule,
  RowGroupingPanelModule,
]);

const VueExample = defineComponent({
  template: `
        <div style="height: 100%">
                <div class="example-wrapper">
      <div class="example-header">
        <label>
          <span>rowGroupPanelSuppressSort:</span>
          <input type="checkbox" id="rowGroupPanelSuppressSort" v-on:click="toggle()">
          </label>
        </div>
        <ag-grid-vue
          style="width: 100%; height: 100%;"
          @grid-ready="onGridReady"
          :columnDefs="columnDefs"
          :defaultColDef="defaultColDef"
          :autoGroupColumnDef="autoGroupColumnDef"
          :rowGroupPanelShow="rowGroupPanelShow"
          :rowData="rowData"></ag-grid-vue>
        </div>
        </div>
    `,
  components: {
    "ag-grid-vue": AgGridVue,
  },
  setup(props) {
    const gridApi = shallowRef<GridApi<IOlympicData> | null>(null);
    const columnDefs = ref<ColDef[]>([
      { field: "country", enableRowGroup: true, rowGroup: true, hide: true },
      { field: "year", enableRowGroup: true, rowGroup: true, hide: true },
      { field: "athlete", minWidth: 180 },
      { field: "total" },
    ]);
    const defaultColDef = ref<ColDef>({
      flex: 1,
      minWidth: 150,
    });
    const autoGroupColumnDef = ref<AutoGroupColumnDef>({
      sort: "asc",
      minWidth: 200,
    });
    const rowGroupPanelShow = ref<"always" | "onlyWhenGrouping" | "never">(
      "always",
    );
    const rowData = ref<IOlympicData[]>(null);

    function toggle() {
      const checked = document.querySelector<HTMLInputElement>(
        "#rowGroupPanelSuppressSort",
      )!.checked;
      gridApi.value!.setGridOption("rowGroupPanelSuppressSort", checked);
    }
    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,
      autoGroupColumnDef,
      rowGroupPanelShow,
      rowData,
      onGridReady,
      toggle,
    };
  },
});

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

[Live example: Prevent Panel Sorting](https://www.ag-grid.com/examples/grouping-group-panel/prevent-panel-sorting/vue3)

The previous example demonstrates the following configuration for preventing the Row Group Panel from sorting columns:

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

this.rowGroupPanelSuppressSort = true;
```

## Prevent Changes to Group Order

The panel can be used to reorder or remove row grouping from columns. To prevent this, `groupLockGroupColumns` can be set to prevent removing or reordering columns. Providing `-1` will lock all columns, or provide a number representing the number of columns to lock.

#### Prevent Group Order Changes

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

ModuleRegistry.registerModules([
  ClientSideRowModelModule,
  RowGroupingModule,
  RowGroupingPanelModule,
]);

const VueExample = defineComponent({
  template: `
        <div style="height: 100%">
                <ag-grid-vue
      style="width: 100%; height: 100%;"
      @grid-ready="onGridReady"
      :columnDefs="columnDefs"
      :defaultColDef="defaultColDef"
      :autoGroupColumnDef="autoGroupColumnDef"
      :rowGroupPanelShow="rowGroupPanelShow"
      :groupLockGroupColumns="groupLockGroupColumns"
      :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: "country", rowGroup: true, hide: true },
      { field: "year", rowGroup: true, hide: true },
      { field: "athlete", minWidth: 180 },
      { field: "total" },
    ]);
    const defaultColDef = ref<ColDef>({
      flex: 1,
      minWidth: 150,
    });
    const autoGroupColumnDef = ref<AutoGroupColumnDef>({
      minWidth: 200,
    });
    const rowGroupPanelShow = ref<"always" | "onlyWhenGrouping" | "never">(
      "always",
    );
    const groupLockGroupColumns = ref(-1);
    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,
      autoGroupColumnDef,
      rowGroupPanelShow,
      groupLockGroupColumns,
      rowData,
      onGridReady,
    };
  },
});

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

[Live example: Prevent Group Order Changes](https://www.ag-grid.com/examples/grouping-group-panel/prevent-group-order-changes/vue3)

The example above demonstrates locking the columns from their grouping being moved or removed:

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

this.groupLockGroupColumns = -1;
```
