AdapTable - Key Concepts

View as Markdown

Summary

  • When developing with AdapTable there are 3 basic concepts to understand:
    • Adaptable Options — how to configure your AdapTable instance
    • Initial Adaptable State — the objects you provide to your application for first-time use
    • Adaptable API — how to access AdapTable at run-time

The 3 Main Classes

The three classes below are key to getting started and making AdapTable work for you.

Adaptable Options

Adaptable Options is a large group of property options which you configure at design-time.

This allows you to set up AdapTable so that it fits the requirements of the containing application.

The available properties include the the adaptableId and many groups of related options (e.g. Entitlements, Layout, Search, Edit, Menu etc.)

Hint

  • Many of the options are JavaScript functions which, if provided, AdapTable will invoke when required
  • Adaptable Options also includes the underlying Initial Adaptable State

Find Out More

Learn more about the options available in Adaptable Options Reference

Initial Adaptable State

Initial State is a group of objects written in JSON that you will define at Design Time.

Caution

  • Providing AdapTable Initial State is optional
  • However a Layout section, with at least one Layout, is mandatory (unless Creating a Default Layout is configured)

It includes all the AdapTable Objects required for initial use of your hosted application e.g. Layouts, Filters, Reports, Alerts, Format Columns etc.

Important

  • Adaptable Initial State contains persistable objects and properties which can change during Application run-time
  • Adaptable Options contains behaviour and functionality that will never change post-creation

The workflow is as follows:

  1. The application starts for the first time and Initial Adaptable State is loaded
  2. The State is then merged with any run-time changes effected by the user
  3. That merged State is then stored (and subsequently reloaded) as Adaptable State

Find Out More

Learn how Initial State works in greater detail in Guide to using Adaptable State and the Initial State Reference

Adaptable API

The Adaptable API provides full, rich, programmatic, run-time access to all AdapTable functionality.

This allows you to access Adaptable State in a 'safe' manner.

Anything that is achievable in the AdapTable UI can be accomplised alternatively using the Adaptable API.

Hint

  • You can even use Adaptable API to connect to AdapTable's functionality via your own custom screens
  • This will then allow you to bypass AdapTable's UI altogether

Find Out More

See the full contents of the Adaptable API in Technical Reference

Fitting It Together

These 3 concepts are linked together when AdapTable is instantiated.

The first two steps - creating Adaptable Options and providing Initial Adaptable State - are identical across all four variants of AdapTable.

Note

  • The final step differs per framework as each has its own mechanism for creating AdapTable and tying it to AG Grid
  • Neverthless each framework's mechanism provides a handle to the same Adaptable API.
Developer Guide

Fitting these 3 Key Concepts Together

const adaptableOptions: AdaptableOptions = {
  licenseKey: '<ADAPTABLE_LICENSE_KEY_HERE>', // license key you were given
  primaryKey: 'tradeId', // a unique column
  adaptableId: 'trading_app', // a unique grid id
  filterOptions: { clearFiltersOnStartUp: true }, // configurable options
  initialState: initialState, // Inital Adaptable State required
};
1
Configure AdapTable Options

Adaptable Options contains a large group of properties and classes.

It is required by all four framework versions to initialise and configure AdapTable.

const initialState: InitialState = {
  Dashboard: {
    Tabs: [{ Name: 'Grid', Toolbars: ['Layout', 'Pricing']}],
  },
  Layout: {
    CurrentLayout: 'Cars',
    Layouts: [
      {
        TableColumns: ['Model', 'Price', 'Make'],
        RowGroupedColumns: ['Make'],
        Name: 'Cars',
      },
    ],
  },
} as InitialState;
2
Provide Initial Adaptable State

Adaptable Options includes Initial Adaptable State as a mandatory property.

This must include a Layout, and in every real-world use case, additional objects.

const agGridConfig: AgGridConfig = {
  gridOptions,     // AG Grid GridOptions object
  agGridModules,   // AG Grid Modules required
};

const adaptableApi: AdaptableApi = await Adaptable.init(adaptableOptions, agGridConfig);
3
Create AdapTable and get the Adaptable API

In the Vanilla (TypeScript) version, the static async Adaptable.init constructor receives the Adaptable Options and an AgGridConfig object.

It returns (via a Promise) the Adaptable API object which gives full run-time access to all AdapTable functionality.

Find Out More

Modules, Plugins, Events, Entitlements, Layouts, AdapTableQL and Logging each have their own dedicated guides