---
product: "AG Grid"
title: "Tree Data - Overview"
description: "Tree Data provides a way to supply the grid with structured hierarchical data."
enterprise: true
framework: vue
version: "36.2.0"
related:
    - title: "Supplying Data"
      url: "https://www.ag-grid.com/archive/36.2.0/vue-data-grid/tree-data-data/"
    - title: "Group Column"
      url: "https://www.ag-grid.com/archive/36.2.0/vue-data-grid/tree-data-group-column/"
    - title: "Expanding Groups"
      url: "https://www.ag-grid.com/archive/36.2.0/vue-data-grid/tree-data-opening-groups/"
    - title: "Tree Selection"
      url: "https://www.ag-grid.com/archive/36.2.0/vue-data-grid/tree-data-selection/"
    - title: "Filtering"
      url: "https://www.ag-grid.com/archive/36.2.0/vue-data-grid/tree-data-filtering/"
    - title: "Tree Row Dragging"
      url: "https://www.ag-grid.com/archive/36.2.0/vue-data-grid/tree-data-row-dragging/"
llms: "https://www.ag-grid.com/archive/36.2.0/llms.txt"
---

# Tree Data - Overview

Tree Data provides a way to supply the grid with structured hierarchical data.

#### Kitchen Sink

```ts
import {
  createApp,
  defineComponent,
  onBeforeMount,
  ref,
  shallowRef,
} from "vue";
import { AgGridVue } from "ag-grid-vue3";
import {
  AutoGroupColumnDef,
  ClientSideRowModelModule,
  ColDef,
  ColGroupDef,
  GetDataPath,
  GridApi,
  GridOptions,
  GridReadyEvent,
  ModuleRegistry,
  enableDevValidations,
} from "ag-grid-community";
import { TreeDataModule } from "ag-grid-enterprise";
import { getData } from "./data";

if (process.env.NODE_ENV !== "production") {
  // Enable extended validations only for development
  enableDevValidations();
}

ModuleRegistry.registerModules([ClientSideRowModelModule, TreeDataModule]);

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"
      :rowData="rowData"
      :treeData="true"
      :groupDefaultExpanded="groupDefaultExpanded"
      :getDataPath="getDataPath"></ag-grid-vue>
        </div>
    `,
  components: {
    "ag-grid-vue": AgGridVue,
  },
  setup(props) {
    const gridApi = shallowRef<GridApi | null>(null);
    const columnDefs = ref<ColDef[]>([
      { field: "created" },
      { field: "modified" },
      {
        field: "size",
        aggFunc: "sum",
        valueFormatter: (params) => {
          if (params.value == null) {
            return ""; // params.value can be null/undefined here (e.g. no size for this row)
          }
          const sizeInKb = params.value / 1024;
          if (sizeInKb > 1024) {
            return `${+(sizeInKb / 1024).toFixed(2)} MB`;
          } else {
            return `${+sizeInKb.toFixed(2)} KB`;
          }
        },
      },
    ]);
    const defaultColDef = ref<ColDef>({
      flex: 1,
    });
    const autoGroupColumnDef = ref<AutoGroupColumnDef>({
      headerName: "File Explorer",
      minWidth: 280,
      cellRendererParams: {
        suppressCount: true,
      },
    });
    const rowData = ref<any[] | null>(getData());
    const groupDefaultExpanded = ref(-1);
    const getDataPath = ref<GetDataPath>((data) => data.path);

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

    return {
      gridApi,
      columnDefs,
      defaultColDef,
      autoGroupColumnDef,
      rowData,
      groupDefaultExpanded,
      getDataPath,
      onGridReady,
    };
  },
});

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

[Live example: Kitchen Sink](https://www.ag-grid.com/archive/36.2.0/examples/tree-data/kitchen-sink/vue3/)

## Enabling Tree Data

To enable Tree Data set the `treeData` property to `true` in the grid options, and provide a `getDataPath` callback to configure the [Row Hierarchy](https://www.ag-grid.com/archive/36.2.0/vue-data-grid/tree-data-paths/). Alternatively, see how to [Provide Tree Data](https://www.ag-grid.com/archive/36.2.0/vue-data-grid/tree-data-data/).

The example above uses the following configuration to enable Tree Data:

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

this.treeData = true;
this.getDataPath = data => data.path;
```

## API Reference

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `treeData` | `boolean` |  |  |  |
| `getDataPath` | `GetDataPath` |  |  |  |
| `treeDataChildrenField` | `string` |  |  |  |
| `treeDataParentIdField` | `string` |  |  |  |
| `treeDataDisplayType` | `TreeDataDisplayType` |  |  |  |
| `autoGroupColumnDef` | `AutoGroupColumnDef` |  |  |  |
| `groupDefaultExpanded` | `number` |  |  |  |
| `isGroupOpenByDefault` | `IsGroupOpenByDefault` |  |  |  |
| `suppressGroupRowsSticky` | `boolean` |  |  |  |
| `stickyRowsMaxViewportRatio` | `number` |  |  |  |
