AdapTable Events

AdapTable fires a number of Events providing information about everything that is happening inside the grid.

Users can subscribe to these Events, and respond as appropriate, via the Adaptable Api.

important

In addition to these events, the Audit Log can be configured to fire an event whenever User State or underlying data changes.

FDC3 Schemea

All Events use the standard FDC3 Context Data Specification.

With the exception of AdaptableReady all Events follow the same pattern:

  • They will publish an xxxEventArgs class.
  • This will contain an xxxEventData array as the data property (the only property)
  • The only item in this array will have an id property of type xxxInfo
  • This class will always include the Adaptable API together with any other relevant objects.

Subscribing to Events

You subscribe to an event using the on method of the Event Api.

This takes 2 parameters:

For example the definition of the LayoutUpdatedEvent is:

on(
eventName: 'LayoutUpdated',
callback: (layoutUpdatedEventArgs: LayoutUpdatedEventArgs) => void
): () => void;

And so to subscribe to the event you could do:

api.eventApi.on('LayoutUpdated', (layoutUpdatedEventArgs: LayoutUpdatedEventArgs) => {
const eventData: LayoutUpdatedEventData[] = layoutUpdatedEventArgs.data;
const eventInfo: LayoutUpdatedInfo = eventData[0].id;
const layout: Layout = eventInfo.layout;
const trigger = eventInfo.layoutUpdatedTrigger;
// do something with the layout
});

Unsubscribing from Events

There is a parallel unsubsciption off method in the Event Api.

This takes the same form as the on method, so the definition for the LayoutUpdatedEvent is simply:

off(
eventName: 'LayoutUpdated',
callback: (layoutUpdatedEventArgs: LayoutUpdatedEventArgs) => void
): () => void;

Adaptable Events

The Events which are currently fired by AdapTable are:

EventWhen Fired
AdaptableReadyAdaptable is initialised and ready for use (has no Args class)
LayoutUpdatedCurrent layout changes
SearchChangedState has changed in any of the Search-related functions (e.g. Current Query, Filters, Data Source etc.)
SelectionChangedUser changes the Cell or Rows selection
GridDataChangedUser makes an edit in a Grid Cell or a ticking data change is made
ThemeChangedThe Theme in Adaptable has changed
AlertFiredAn alert is triggered in Adaptable
ToolbarVisibilityChangedA toolbar comes into view (useful for rendering Custom toolbars)
ToolbarButtonClickedA custom button is clicked in the Dashboard
CustomToolbarConfiguredThe 'configure' button is clicked in a Custom Toolbar
ActionColumnClickedThe button in an Action Column has been clicked
LiveDataChangedSomething happens related to the various 'live reports' that AdapTable offers

Demos

Visit the AdapTable Demo Site to see a number of state-related demos