AdapTable State Guide

View as Markdown

Summary

  • AdapTable State is the UI configuration for an instance: Layouts, searches, styles, and the other Module objects
  • Developers ship Initial Adaptable State at design-time (a Layout section is required)
  • Coding agents can also be used to manage State - in 2 ways:
  • First load merges that into User State; later loads restore the persisted User State
  • Persistence is automatic (localStorage by default); most production apps use remote loadState / persistState
  • Some sections are transient and are never persisted
  • Support and developers inspect live State in AdapTable DevTools (Manage State or the In-page API)

Important

  • AdapTable State does not include AG Grid data; it deals only with the AdapTable UI and associated objects
  • Likewise AdapTable does not have access to the clients' private data

AdapTable State is how an instance remembers its configuration between sessions.

Developers populate Initial Adaptable State at design-time. Users then add, edit and delete objects at run-time.

Note

Entitlements, options and other design-time settings that users cannot change live in Adaptable Options, not in State

Those changes are persisted and re-applied on the next start.

Find Out More

Using Agent Skills

There are two common ways to work on Adaptable State with a coding agent:
Day-to-day Development

adaptable-dev Agent Skill


Install Agent Skills, then run the adaptable-dev skill to add or change Initial Adaptable State — Layouts, Filters, Format and Styled Columns, Alerts and the other persistable objects.

The agent designs from the docs for your installed version, then validates with `check state` and `check expression` through the adaptable CLI.

Major Version Upgrade

adaptable-upgrade Agent Skill


Run the adaptable-upgrade skill to plan a move to a newer AdapTable major, migrate Initial State and user State, and pair the required AG Grid upgrade.

Rehearse with the State Migration Tool or DevTools — Manage State Migrate tab, then run `check state` on the migrated JSON before you ship.

How AdapTable State Works

1
Design Time: Developers Supply Initial Adaptable State

At design-time developers create Initial Adaptable State.

This is a JSON object that contains the items the AdapTable instance requires for first use.

It consists of multiple sections — each relating to one Module in AdapTable.

Other sections are optional - with the exception of Layout which is required and must contain at least one Layout (unless Default Layouts are configured).

Some of the contents of each section are collections of Adaptable Objects (e.g. Layouts) but can also be string properties (e.g. name of the Current Layout).

2
First Time AdapTable Loads

When the application loads for the first time, the Initial Adaptable State is read into memory.

This Initial State is then stored as AdapTable State and is updated (and automatically persisted) with any user state that is created during that session.

It can be stored locally or remotely depending on your settings.

3
Subsequent Application Re-Loads

Each later launch retrieves that persisted User State and pre-populates the AdapTable instance with it.

Users see the same configuration they had on their previous visit.

Hint

The Revision property lets you update a section of Initial State after go-live without wiping the rest of User State

What is Persisted

Most of AdapTable State is persisted. That persisted object is the Initial State sections plus Team Sharing (Team Sharing is run-time only — it is not part of Initial State).

These sections are transient: they exist in the in-memory store but are never written by persistState:

  • Internal
  • Popup
  • Comment
  • Plugins

Default AdapTable State

AdapTable State is almost entirely empty when the Application starts for the first time.

It is then populated by the supplied Initial Adaptable State.

A few defaults are provided for convenience:

Note

All of these can be replaced by properties in Initial Adaptable State if necessary

ModuleDefault Property Description
DashboardModuleButtons is an empty list
Quick SearchDefault highlight style (black text on yellow)
ThemeCurrent Theme is set to light
Tool PanelA SettingsPanel Button is provided in the ModuleButtons property

Redux

Internally AdapTable uses Redux to manage its state.

This provides a uni-directional store for all the objects used in the grid.

Caution

If using Redux in your application, continue to maintain your own Store; merging the 2 Stores can cause complications

Pages in this Section

The pages follow the State lifecycle:

  1. Provide Initial State
  2. Persist User State
  3. Update Initial State after go-live
  4. Customise, suspend and listen
  5. Manage in the UI, migrate between versions, then the API
PageSummary
Providing Initial Adaptable StateDesign-time objects for first use — Layout is required
AdapTable State Persistence GuidelocalStorage by default, or your own loadState / persistState
Updating Initial AdapTable StateShip section Revisions after go-live without wiping User State
Custom AdapTable StateStore your own key / value pairs in the Application section
Suspending Adaptable ObjectsTurn objects off with IsSuspended without deleting them
Listening to AdapTable StateAdaptableStateChanged, BeforeAdaptableStateChange and reload
Managing AdapTable State at Run-TimeImport, export and clear State in the Settings Panel (hidden by default)
Migrating Adaptable StateAutomatic migration on load, or migrateAdaptableState by hand
State Migration ToolPaste State for one major version and migrate it to another
Adaptable State Technical ReferenceState Options, State API and Event Info

FAQ

Where is AdapTable State stored? By default it is stored in the browser's local storage, under adaptableStateKey (which defaults to adaptableId if you omit it). Use the State Options functions to save State in any location you specify (and to enrich it en route).

Do you provide data adapters to fetch / save AdapTable State? No we don't, you will need to provide the mechanism to store your State in a remote location. There are simply too many different storage locations and mechanisms for us to provide connectors.

Does AdapTable persist everything in the Redux store? No. Internal, Popup, Comment and Plugins are transient and never written by persistState.

Can a coding agent author or migrate State? Use adaptable-dev for day-to-day initialState work and adaptable-upgrade for major upgrades; both rely on `check state`. For a live Grid on a ticket, use adaptable-debug.