Managing AdapTable State at Run-Time

View as Markdown

Summary

  • The primary place to manage State at run-time is in AdapTable DevTools
  • Additionally, the State Management Module inside AdapTable contains much of the same functionality

AdapTable State usually just 'happens' without the User being aware of the persistence mechanism or needing to do anything in particular.

But sometimes State doesn't behave the way you expect, or you might need to manage it in other ways.

Accordingly, AdapTable provides 2 resources to enable AdapTable State to be managed at run-time:

  • AdapTable DevTools in Chrome - has a comprehensive State Management section
  • State Management Module - available in the Settings Panel (hidden by default)

AdapTable DevTools

AdapTable DevTools records snapshots of Adaptable State as the Grid runs — tag, restore, compare, upload/download JSON, and migrate — without entitling the in-app module.

Find Out More

Install and pick an instance on AdapTable DevTools. Handbook walkthrough — DevTools — Manage State. Inspect versions and layout first — DevTools — Grid Info.

State Management Module

The Statement Management Module also allows run-time users to import and export AdapTable State.

Its functionality can be accessed in 3 UI components:

  • The Manage State section in the Settings Panel
  • The Manage State Toolbar in the Dashboard
  • The Manage State Tool Panel in the AdapTable Tool Panel Component

Important

  • Due to its more "support-like" nature, the State Management Module is Hidden by default
  • To make it available, set its Entitlement to Full (or ReadOnly) for those users who need it:
entitlementOptions: {
  moduleEntitlements: [{ adaptableModule: 'StateManagement', accessLevel: 'Full' }],
},
  • Setting defaultAccessLevel to Full doesn't unhide the Module; it must be entitled explicitly in moduleEntitlements

Module Functionality

All 3 Manage State components contain 4 State-related options:

  • Clearing User State
  • Loading Initial Adaptable State (from a JSON file)
  • Exporting the AdapTable State - to Clipboard, Console or JSON
  • Exporting Initial Adaptable State - to Clipboard, Console or JSON

Caution

Clearing User State will re-load the initial Initial Adaptable State that was provided

Note

  • If using Local Storage, AdapTable will automatically clear what is in the User's State
  • If using Remote Storage, AdapTable will invoke the clearState function that was provided at design-time
State Management Module
Fork
Loading demo…

Reloading Initial State

The Manage State panel allows you to re-apply your Initial Adaptable State using a JSON file.

This is done using the Load Initial Adaptable State button.

When clicked, AdapTable will replace the current State with the State in the uploaded file.

Load Initial Adaptable State
Fork
  • The demo illustrates how to reload the Initial Adaptable State using the Manage State Settings Panel
  • Initial State includes a Format Column on Name (blue). Change Format Columns replaces it with runtime styles on Github Stars and Language; reloading from the downloadable file restores Name
Try It Out
  • On load, confirm Name is styled blue (from Initial State)
  • Click Change Format Columns — Name styling is removed and Github Stars (yellow) / Language (green) appear instead
  • Download this file: initial-adaptable-state.json
  • Open the Settings Panel using the Manage State module button, and then click Load Initial Adaptable State to select the downloaded file
  • Runtime styles disappear and Name (blue) returns — confirming the Grid was restored from the file
Loading demo…