Listening to AdapTable State

Summary

  • The AdapTable State Changed Event fires whenever anything changes in Adaptable State
  • This provides a comprehensive overview of all activity in AdapTable and AG Grid
  • The AdapTable State Reloaded Event fires when State reloads for whatever reason

AdapTable provides a comprehensive overview of all AdapTable state changes.

This means all grid activity - every action, layout change, mouse click etc. - can be listened to as required.

Hint

The Event's messages can easily be streamed to 3rd party monitoring applications for use by Support Teams

This is achieved using the Adaptable State Changed Event which provides a stream of all state changes.

Note

There is also an Adaptable State Reloaded Event which fires when the State is reloaded

AdapTable State Changed Event

The Adaptable State Changed Event is fired every time that any Adaptable State changes.

The Event's Info provides very extensive information about the State Change in question including:

  • what action triggered the change
  • who was the user
  • when it happend
  • which AdapTable instance
  • before and after copies of Adaptable State
Adaptable State Changes
Fork
  • In this example we listen to the Adaptable State Changed Event and output each Message:
    • In full to the console
    • As a System Status Message with the Action Name as the Header and the full message as the Description
Try It Out

Perform some typical activity in the Grid and open System Status screen to see the full details of all the messages sent

Filtering State Changed Messages

The Event's Args can be filtered so only particular actions are logged.

Hint

This allows Support Teams to listen only to the grid changes that they are interested in

Filtering Adaptable State Changed Messages
Fork
  • In this example we filter the Adaptable State Changed Event only to log messages relating to Quick Search, Column Filters and the Grid Filter.
  • We send the messages provided by the Event:
    • In full to the console
    • As a System Status Message with the Action Name as the Header and the full message as the Description
Try It Out
  • Run some quick searches and see the Event messages that are sent
  • Perform other Grid actions and note that nothing is sent processed by the Event

Actions

Each State Change is triggered by a Redux Action (the technical solution Adaptable uses to manage state)

Each Action contains useful objects pertaining to that particular change.

For instance the GRID_DATA_CHANGED and GRID_DATA_EDITED actions both contain a CellDataChangedInfo object that provides full details of the the column, row, and new and old values.

Action Names

To help Support Teams, the actionName property in the Action is also provided as a full level property.

It describes exactly what the Action does, and can be used to listen to a particular State Change.

For instance to react to values being changed a FreeText Column you would do:

api.eventApi.on(
  'AdaptableStateChanged',
  (statechangedInfo: AdaptableStateChangedInfo) => {
    if (
      statechangedInfo.actionName == 'FREE_TEXT_COLUMN_ADD_EDIT_STORED_VALUE'
    ) {
      // do something with the change
    }
  }
);
Deep Dive

Full Action Name List

AdapTable State Reloaded

AdapTable also provides an AdaptableStateReloaded Event which fires whenever the State reloads.

The EventInfo contains the new and old state allowing users easily to diff the changes.