AdapTable and AG Grid GridOptions

View as Markdown

Summary

  • 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 or in AdapTable's menu options)
  • required by AdapTable for some functionality

Note

How AdapTable treats AG Grid ColDefs (column order, visibility, grouping, and so on) is covered in Managing Columns — particularly Configuring ColDefs at Design-Time

Ignored Grid Options Props

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

Note

  • This most usually occurs when AdapTable provides the same functionality at a Layout level
  • Per-Layout configuration allows you to set different behaviour for different use cases

The more important of these GridOptions properties are:

GridOptions propertyAdapTable Layout PropertyNotes
grandTotalRowGrandTotalRowCan be one of: top bottom pinnedTop pinnedBottom boolean
suppressAggFuncInHeaderSuppressAggFuncInHeaderAllows this to be set on a per-Layout basis
rowSelectionRowSelectionIf 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 propertyAdapTable alternativeNotes
getContextMenuItemscontextMenuOptions.customContextMenu - see Custom Context Menu Items
getColumnMenuItemscolumnMenuOptions.customColumnMenu - see Custom Column Menu ItemsThe Columns Tool Panel and Column Chooser menus show AG Grid's default items
getMainMenuItemscolumnMenuOptions.customColumnMenu - see Custom Column Menu Items

Note

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 and Tool Panel
  • 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

Note

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.

Hint

These also require the matching AG Grid Modules — StatusBarModule and SideBarModule (or AllEnterpriseModule). See AG Grid Modules

Status Bar

AdapTable adds its own Status Bar Panels 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 uses to populate the panel.

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.

Caution

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

Find Out More

See AdapTable Status Bar for how to fill the panels, and how to mix them with AG Grid Status Panels

Tool Panel

AdapTable adds its own Tool Panel 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']

Find Out More

See Configuring the Tool Panel for more information