# AdapTable and AG Grid GridOptions

Canonical page: https://www.adaptabletools.com/docs/dev-guide-aggrid-configuring-gridoptions

- Most AG Grid GridOptions properties work the same when AdapTable is being used
- Some GridOptions properties are **ignored** (in favour of AdapTable alternatives)
- Other properties must be **provided** for some AdapTable UI to appear

The vast majority of properties in AG Grid's `GridOptions` object work as normal when using AdapTable.

In other words, AdapTable has no opinions on whether or not they should be provided.

However there are some GridOptions properties which are affected when using AdapTable.

These properties can be divided into 2 groups:

- **ignored** by AdapTable (as alternatives are provided in the [Layout](https://www.adaptabletools.com/docs/handbook-layouts/index.md) or in AdapTable's menu options)
- **required** by AdapTable for some functionality

How AdapTable treats AG Grid **ColDefs** (column order, visibility, grouping, and so on) is covered in [Managing Columns](https://www.adaptabletools.com/docs/dev-guide-columns-overview/index.md) — particularly [Configuring ColDefs at Design-Time](https://www.adaptabletools.com/docs/dev-guide-columns-configuring-coldefs/index.md)

## Ignored Grid Options Props

Some GridOptions properties will be ignored by AdapTable and their value will not be reflected in the Grid.

- This most usually occurs when AdapTable provides the same functionality at a [Layout](https://www.adaptabletools.com/docs/handbook-layouts/index.md) level
- Per-Layout configuration allows you to set different behaviour for different use cases

The more important of these GridOptions properties are:

| GridOptions property      | AdapTable Layout Property | Notes                                                                                                                                  |
| ------------------------- | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `grandTotalRow`           | `GrandTotalRow`           | Can be one of: `top` `bottom` `pinnedTop` `pinnedBottom` `boolean`                                                                     |
| `suppressAggFuncInHeader` | `SuppressAggFuncInHeader` | Allows this to be set on a per-Layout basis                                                                                            |
| `rowSelection`            | `RowSelection`            | If provided in Layout or explicitly set to false, AG Grid prop ignored; but if Layout prop is undefined, we fall back to AG Grid value |

AG Grid's menu callbacks are also ignored, as AdapTable builds the Context Menu and Column Menu itself:

| GridOptions property  | AdapTable alternative                                                                                        | Notes                                                                                 |
| --------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------- |
| `getContextMenuItems` | `contextMenuOptions.customContextMenu` - see [Custom Context Menu Items](https://www.adaptabletools.com/docs/ui-context-menu-custom-items/index.md) |                                                                                       |
| `getColumnMenuItems`  | `columnMenuOptions.customColumnMenu` - see [Custom Column Menu Items](https://www.adaptabletools.com/docs/ui-column-menu-custom-items/index.md)    | The Columns Tool Panel and Column Chooser menus show AG Grid's default items          |
| `getMainMenuItems`    | `columnMenuOptions.customColumnMenu` - see [Custom Column Menu Items](https://www.adaptabletools.com/docs/ui-column-menu-custom-items/index.md)    |                                                                                       |

AdapTable logs a console warning at start-up when any of these callbacks is provided

## Global Grid Options

AG Grid's `provideGlobalGridOptions` sets GridOptions for every grid in an application.

AdapTable handles a GridOptions property provided with `provideGlobalGridOptions` exactly as if it were provided in the `gridOptions` of each grid, e.g.:

- a global `statusBar` or `sideBar` shows the AdapTable [Status Bar Panels](https://www.adaptabletools.com/docs/ui-status-bar/index.md) and [Tool Panel](https://www.adaptabletools.com/docs/ui-tool-panel/index.md)
- a global `getRowStyle` or `getRowClass` is combined with the row styles AdapTable applies
- a global `getRowId` is used instead of the one AdapTable builds from the [Primary Key](https://www.adaptabletools.com/docs/getting-started-primary-key/index.md)

With the `'deep'` merge strategy, when a grid and the global options both provide the same object property (e.g. `defaultColDef`), AdapTable handles the grid's value, and AG Grid then merges the global value into it

## Leveraged Grid Options Props

Some functionality in AdapTable requires that relevant GridOptions properties be appropriately configured.

This primarily occurs where AdapTable adds its own content into AG Grid's UI components.

These also require the matching AG Grid Modules — `StatusBarModule` and `SideBarModule` (or `AllEnterpriseModule`). See [AG Grid Modules](https://www.adaptabletools.com/docs/getting-started-aggrid-modules/index.md)

### Status Bar

AdapTable adds its own [Status Bar Panels](https://www.adaptabletools.com/docs/ui-status-bar/index.md) into the AG Grid **Status Bar**.

To show them, provide `statusBar` in GridOptions with one or more panels whose `statusPanel` is `AdaptableStatusPanel`.

Each AdapTable panel also needs a unique `key`. That key is what [Status Bar Initial State](https://www.adaptabletools.com/docs/technical-reference-status-bar/index.md) uses to populate the panel.

```ts
const gridOptions: GridOptions = {
  statusBar: {
    statusPanels: [
      {
        key: 'Left Panel',
        statusPanel: 'AdaptableStatusPanel',
        align: 'left',
      },
      {
        key: 'Center Panel',
        statusPanel: 'AdaptableStatusPanel',
        align: 'center',
      },
    ],
  },
};
```

AG Grid's own Status Panels (for example `agTotalAndFilteredRowCountComponent`) can be listed in the same `statusPanels` array.

If `statusBar` is omitted, AdapTable Status Bar Panels will not appear — there is no `statusBar: true` shortcut

See [AdapTable Status Bar](https://www.adaptabletools.com/docs/ui-status-bar/index.md) for how to fill the panels, and how to mix them with AG Grid Status Panels

### Tool Panel

AdapTable adds its own [Tool Panel](https://www.adaptabletools.com/docs/ui-tool-panel/index.md) to the AG Grid **Sidebar**, providing access to core AdapTable functionality.

In order to see the AdapTable Tool Panel, the GridOptions `sideBar` property must:

- either be set to true

```
gridOptions.sideBar = true
```

- or explicitly list it in the array, e.g.

```
gridOptions.sideBar = ['adaptable', 'filters']
```

See [Configuring the Tool Panel](https://www.adaptabletools.com/docs/ui-tool-panel-configuring/index.md) for more information
