Integrating AdapTable Angular

View as Markdown

Summary

  • AdapTable Angular requires 3 Angular Components: adaptable-provider, adaptable-ui & ag-grid-angular
  • You can either leverage the adaptable-setup AI Agent Skill or integrate manually

Integration Options

Creating applications that use AdapTable Angular is straightforward.
There are two ways to integrate AdapTable:
Recommended

Coding agent + adaptable-setup


Install the Agent Skills once, then ask your agent to run the adaptable-setup skill. It pairs AG Grid with AdapTable, wires containers and Initial State, and validates setup for your installed version.

Step by step

Manual integration


Clone a support template (CodeSandbox) for a running app, or follow the minimum working example on this page.

Best when you want to learn the wiring, review every line, or work without a coding agent.

Agent Integration

Simply leverage the adaptable-setup AI skill, providing all relevant information:

adaptable-setupAI Skill

add AdapTable to this AG Grid app


set up AdapTable in a new Angular project with rows fetched from https://api.example.com/trades

Manual integration

The sections below walk through the Angular components and a minimum working example.

Defining Key Components

There are 3 key Angular components that need to be provided:

ComponentPurpose
<adaptable-provider>manages Adaptable State and orchestrates the AdapTable and AG Grid components
<adaptable-ui>renders AdapTable's UI including the Dashboard
<ag-grid-angular>standard AG Grid Angular component with the *adaptable structural directive applied

Minimum Working Example

This uses a standalone Angular component (the default for Angular 20).

import {Component} from '@angular/core';
import {AgGridAngular} from 'ag-grid-angular';
import {
  LicenseManager,
  themeQuartz,
  type GridOptions,
  type Module,
} from 'ag-grid-enterprise';
import {AllEnterpriseModule} from 'ag-grid-enterprise';
import {AgChartsEnterpriseModule} from 'ag-charts-enterprise';
import {
  AdaptableProvider,
  AdaptableUI,
  AdaptableAgGridDirective,
  type AdaptableApi,
  type AdaptableOptions,
  type AdaptableReadyInfo,
  type InitialState,
} from '@adaptabletools/adaptable-angular-aggrid';
import '@adaptabletools/adaptable-angular-aggrid/index.css';

LicenseManager.setLicenseKey('<AG_GRID_LICENSE_KEY_HERE>');

@Component({
  selector: 'app-root',
  imports: [
    AdaptableProvider,
    AdaptableUI,
    AdaptableAgGridDirective,
    AgGridAngular,
  ],
  template: `
    <adaptable-provider
      [adaptableOptions]="adaptableOptions"
      [gridOptions]="gridOptions"
      [modules]="agGridModules"
      (adaptableReady)="adaptableReady($event)">
      <adaptable-ui style="flex: none"></adaptable-ui>
      <ag-grid-angular
        *adaptable="let adaptable"
        [gridOptions]="adaptable.gridOptions"
        [modules]="adaptable.modules"
        style="flex: 1">
      </ag-grid-angular>
    </adaptable-provider>
  `,
})
export class AppComponent {
  agGridModules: Module[] = [
    AllEnterpriseModule.with(AgChartsEnterpriseModule),
  ];

  gridOptions: GridOptions = {
    theme: themeQuartz,
    columnDefs: [
      {headerName: 'Id', field: 'id', cellDataType: 'number'},
      {headerName: 'Make', field: 'make', filter: true, cellDataType: 'text'},
      {
        headerName: 'Model',
        field: 'model',
        editable: true,
        cellDataType: 'text',
      },
      {headerName: 'Price', field: 'price', cellDataType: 'number'},
    ],
    rowData: [
      {id: 1, make: 'Toyota', model: 'Yaris', price: 40000},
      {id: 2, make: 'Toyota', model: 'Corolla', price: 28000},
      {id: 3, make: 'Ford', model: 'Mondeo', price: 32000},
    ],
    cellSelection: true,
    sideBar: true,
  };

  initialState: InitialState = {
    Dashboard: {
      PinnedToolbars: ['Layout', 'Export'],
    },
    Layout: {
      CurrentLayout: 'Cars',
      Layouts: [
        {
          Name: 'Cars',
          TableColumns: ['id', 'make', 'model', 'price'],
        },
      ],
    },
  };

  adaptableOptions: AdaptableOptions = {
    licenseKey: '<ADAPTABLE_LICENSE_KEY_HERE>',
    primaryKey: 'id',
    userName: 'Demo User',
    adaptableId: 'Basic Setup',
    initialState: this.initialState,
  };

  adaptableApi?: AdaptableApi;

  adaptableReady = ({adaptableApi, agGridApi}: AdaptableReadyInfo) => {
    this.adaptableApi = adaptableApi;
    adaptableApi.quickSearchApi.runQuickSearch('toy');
    agGridApi.autoSizeAllColumns();
  };
}
Developer Guide

Defining the 3 Angular Components

import {Component} from '@angular/core';
import {AgGridAngular} from 'ag-grid-angular';
import {
  AdaptableProvider,
  AdaptableUI,
  AdaptableAgGridDirective,
} from '@adaptabletools/adaptable-angular-aggrid';

@Component({
  selector: 'app-root',
  imports: [
    AdaptableProvider,
    AdaptableUI,
    AdaptableAgGridDirective,
    AgGridAngular,
  ],
  template: ``,
})
export class AppComponent {}
1
Import the AdapTable and AG Grid Angular components

In a standalone component, import:

  • AdaptableProvider, AdaptableUI and AdaptableAgGridDirective from @adaptabletools/adaptable-angular-aggrid
  • AgGridAngular from ag-grid-angular

Note

If you still use NgModule, import AdaptableAngularAgGridModule and AgGridModule instead of listing the standalone components in imports.

import {AllEnterpriseModule, type Module} from 'ag-grid-enterprise';
import {AgChartsEnterpriseModule} from 'ag-charts-enterprise';

export const agGridModules: Module[] = [
  AllEnterpriseModule.with(AgChartsEnterpriseModule),
];
2
Import and Define AG Grid Enterprise Modules

Import the AG Grid Enterprise Modules.

The support templates use the Enterprise bundle together with AG Charts. That covers AG Grid Charts and AdapTable Sparkline Columns.

Note

  • To register only the modules your feature set needs, see AG Grid Modules
  • In AG Grid 36 the Client-Side Row Model is part of the grid core, so ClientSideRowModelModule is not required
import {themeQuartz, type GridOptions} from 'ag-grid-enterprise';

const gridOptions: GridOptions = {
  theme: themeQuartz,
  columnDefs: [
    {headerName: 'Id', field: 'id', cellDataType: 'number'},
    {headerName: 'Make', field: 'make', filter: true, cellDataType: 'text'},
    {headerName: 'Model', field: 'model', editable: true, cellDataType: 'text'},
    {headerName: 'Price', field: 'price', cellDataType: 'number'},
  ],
  rowData: [
    {id: 1, make: 'Toyota', model: 'Yaris', price: 40000},
    {id: 2, make: 'Toyota', model: 'Corolla', price: 28000},
    {id: 3, make: 'Ford', model: 'Mondeo', price: 32000},
  ],
  cellSelection: true,
  sideBar: true,
};
3
Create an AG Grid GridOptions object

Define and populate a standard AG Grid GridOptions object.

Provide all required AG Grid related information including:

  • AG Grid theme (themeQuartz in this example)
  • column schema (including the correct cell data types)
  • initial data (if not lazy loading)
  • AG Grid events
  • additional, required properties

Caution

  • All GridOptions properties should be included in the gridOptions Input (not as direct Inputs on the <ag-grid-angular> component)
  • This approach ensures a consistent and streamlined interface for grid configuration in all scenarios (lazy loading, server-side data, etc.)

Note

  • The rowData prop is the only exception and has flexibility to be passed as a separate input to the <ag-grid-angular> component
  • However, this is not mandatory, and it can also be included within the gridOptions Input, with the other props

Caution

Note

  • AG Grid Enterprise also requires its own license key
  • Set it with LicenseManager.setLicenseKey from ag-grid-enterprise (the support template shows this)
import {
  type AdaptableApi,
  type AdaptableOptions,
  type AdaptableReadyInfo,
  type InitialState,
} from '@adaptabletools/adaptable-angular-aggrid';
4
Import AdapTable's types

Import AdapTable Types from @adaptabletools/adaptable-angular-aggrid (e.g. AdaptableApi, AdaptableOptions, InitialState)

import '@adaptabletools/adaptable-angular-aggrid/index.css';
5
Import AdapTable Styles via index.css

index.css contains core styles (and supports both light and dark themes)

Hint

  • AdapTable's styles use the adaptable CSS layer - so you can access that to control specificity
  • If your app is using Tailwind, we recommend using this CSS layer order: @layer theme, base, components, adaptable, utilities
  • See AdapTable Theming Guide for full details on choosing and extending AdapTable Themes
const initialState: InitialState = {
  Dashboard: {
    PinnedToolbars: ['Layout', 'Export'],
  },
  Layout: {
    CurrentLayout: 'Cars',
    Layouts: [
      {
        Name: 'Cars',
        TableColumns: ['id', 'make', 'model', 'price'],
      },
    ],
  },
};
6
Provide Initial Adaptable State

Add the Initial Adaptable State that is required to ship AdapTable with the objects you require for initial use.

This will later get merged into Adaptable State, together with any changes made by the run-time user.

It must include a Layouts section, containing at least one Layout (unless using Default Layouts).

In this example we:

  • Pin the Layout and Export Toolbars on the Dashboard
  • Create a Layout "Cars" whose ColumnIds match the ColDef field values
const adaptableOptions: AdaptableOptions = {
  licenseKey: '<ADAPTABLE_LICENSE_KEY_HERE>',
  primaryKey: 'id',
  userName: 'Demo User',
  adaptableId: 'Basic Setup',
  initialState,
};
7
Create an Adaptable Options object

Adaptable Options defines exactly how AdapTable should work.

Every instance needs:

  • a Primary Key — a unique column
  • an Adaptable Id which uniquely identifies the Grid
  • the License Key provided when you purchase AdapTable
  • a User Name to identify the current user
  • the initialState created in Step 6

Hint

Adaptable Options supports TypeScript Generics which ensures a better developer experience by providing the row data type

Important

If the licenseKey property is not present, AdapTable will display a watermark and run with reduced functionality

Note

<adaptable-provider
  [adaptableOptions]="adaptableOptions"
  [gridOptions]="gridOptions"
  [modules]="agGridModules"
  (adaptableReady)="adaptableReady($event)">
  <adaptable-ui style="flex: none"></adaptable-ui>
  <ag-grid-angular
    *adaptable="let adaptable"
    [gridOptions]="adaptable.gridOptions"
    [modules]="adaptable.modules"
    style="flex: 1">
  </ag-grid-angular>
</adaptable-provider

8
Render the three Angular components

Render <adaptable-provider> with these mandatory inputs:

  • adaptableOptions — the object created in Step 7
  • gridOptions — GridOptions object created in Step 3
  • modules — Modules array created in Step 2

Inside the provider, render <adaptable-ui> and <ag-grid-angular> with AdapTable's *adaptable structural directive.

<ag-grid-angular> must take gridOptions and modules from the AdapTable context — not from the parent component.

Caution

  • The <ag-grid-angular> component should get its gridOptions and modules Inputs from the Adaptable context
  • They should not be given directly from the parent component

Hint

  • Always use a single gridOptions Input for all grid related props, not as direct Inputs on the <ag-grid-angular> component
  • This ensures a consistent and streamlined grid configuration in all scenarios (lazy loading, server-side data, etc.)
adaptableReady = ({adaptableApi, agGridApi}: AdaptableReadyInfo) => {
  this.adaptableApi = adaptableApi;
  adaptableApi.quickSearchApi.runQuickSearch('toy');
  agGridApi.autoSizeAllColumns();
};
9
Listen to the AdaptableReady Event (optional)

The Adaptable Ready Event is fired when AdapTable is initialised, and should be used to perform any setup related actions required.

Bind (adaptableReady) on <adaptable-provider> and handle it on the component class.

The AdaptableReadyInfo object provided by the Event contains 2 important objects:

  • adaptableApi which gives access to the Adaptable API
  • agGridApi which gives access to AG Grid's Api

Caution

  • AG Grid's gridReady event should not be used - because it will fire before AdapTable has initialised
  • Instead, you should always use AdapTable's adaptableReady event

FAQ

I get an error message: Uncaught TypeError: Cannot read properties of undefined (reading 'api') Make sure that you are passing in all GridOptions properties directly on the GridOptions object itself, and not as direct Inputs on the <ag-grid-angular> component

Find Out More

Common first-run questions (modules, cell data types, browsers, watermarks) are on the Getting Started FAQ.

AdapTable Resources