# Adaptable Events Reference

Canonical page: https://www.adaptabletools.com/docs/technical-reference-adaptable-events

- AdapTable publishes a number of **Events** throughout the application lifecycle
- These events provide rich information about everything that is happening inside AdapTable and AG Grid
- Some events reflect user actions, others react to changes in the grid or its data
- Two particularly important events are:
  - `AdaptableReady` fires when AdapTable is initialised and the State is loaded enabling post setup actions
  - `AdaptableStateChanged` fires whenever anything changes in [AdapTable State](https://www.adaptabletools.com/docs/dev-guide-adaptable-state/index.md)

## Understanding Adaptable Events

AdapTable fires many Events throughout the application's lifecycle to which developers can subscribe.

Most AdapTable Events react to one of 2 types of action:

- An **AdapTable** Module or functionality doing something

  Examples include `LayoutChanged`, `SystemStatusMessageDisplayed`, `AlertFired`, `DashboardChanged` etc.

- Something happening in **AG Grid**

  Examples include `CellChanged`, `CellSelectionChanged`, `RowChanged` etc.

## Subscribing to Events

Subscription to Adaptable Events is done via the `on` method in the **Event** section of the [Adaptable API](https://www.adaptabletools.com/docs/technical-reference-adaptable-api/index.md).

This takes 2 parameters:

- `eventName` - name of the Adaptable Event being subscribed to
- `callback` - object containing relevant information to the Adaptable Event and why it fired

The callback argument is the matching `*Info` object, for example `LayoutChangedInfo`. `AdaptableDestroy` has no payload.

### Base Context

Every `EventInfo` object inherits from the [`BaseContext`](https://www.adaptabletools.com/docs/reference/basecontext.md) object which has these properties:

| Property | Type | Description |
| --- | --- | --- |
| [adaptableApi](https://www.adaptabletools.com/docs/reference/basecontext.md#adaptableapi) | [`AdaptableApi`](https://www.adaptabletools.com/docs/reference/adaptableapi.md) | Adaptable Api object |
| [adaptableContext](https://www.adaptabletools.com/docs/reference/basecontext.md#adaptablecontext) | `any` | Custom application Context provided in `AdaptableOptions.adaptableContext` |
| [adaptableId](https://www.adaptabletools.com/docs/reference/basecontext.md#adaptableid) | `string` | Id of current AdapTable instance |
| [adaptableStateKey](https://www.adaptabletools.com/docs/reference/basecontext.md#adaptablestatekey) | `string` | Current Adaptable State Key |
| [clientTimestamp](https://www.adaptabletools.com/docs/reference/basecontext.md#clienttimestamp) | `Date` | Time on user&#39;s computer |
| [userName](https://www.adaptabletools.com/docs/reference/basecontext.md#username) | `string` | Name of Current User |

For example the definition of the [LayoutChangedEvent](https://www.adaptabletools.com/docs/technical-reference-layouts/index.md) is:

```ts
on(
    eventName: 'LayoutChanged',
    callback: (eventInfo: LayoutChangedInfo) => void
): () => void;
```

So to subscribe to the event you can do something like:

```ts
adaptableApi.eventApi.on('LayoutChanged', (eventInfo: LayoutChangedInfo) => {
  // do something with the info
});
```

## Unsubscribing from Events

For every Adaptable Event there is a parallel unsubscription `off` method.

This takes the same form as the `on` method, so unsubscribing from the [LayoutChangedEvent](https://www.adaptabletools.com/docs/technical-reference-layouts/index.md) is simply:

```ts
off(
    eventName: 'LayoutChanged',
    callback: (eventInfo: LayoutChangedInfo) => void
): () => void;
```

## List of Adaptable Events

| Adaptable Event                                                                                         | When Fired                                                          |
| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| [`Adaptable Destroy`](https://www.adaptabletools.com/docs/reference/eventapi.md)                                                     | AdapTable has been destroyed and should no longer be used           |
| [Adaptable Ready](https://www.adaptabletools.com/docs/technical-reference-getting-started/index.md)                       | AdapTable has finished initialising and the Store is up and running |
| [Adaptable State Changed](https://www.adaptabletools.com/docs/technical-reference-adaptable-state/index.md)               | Something has changed in AdapTable State                            |
| [Adaptable State Reloaded](https://www.adaptabletools.com/docs/technical-reference-adaptable-state/index.md)              | AdapTable State has been reloaded                                   |
| [Alert Fired](https://www.adaptabletools.com/docs/technical-reference-alerting/index.md)                                  | An Alert has been Fired in AdapTable                                |
| [Before Adaptable State Change](https://www.adaptabletools.com/docs/technical-reference-adaptable-state/index.md)         | Something is about to change in AdapTable State                     |
| [Calculated Column Changed](https://www.adaptabletools.com/docs/technical-reference-calculated-column/index.md)           | A Calculated Column has been added, edited or deleted               |
| [Cell Changed](https://www.adaptabletools.com/docs/technical-reference-editing/index.md)                                  | User makes an edit in a Grid Cell or a ticking data change is made  |
| [Cell Selection Changed](https://www.adaptabletools.com/docs/technical-reference-selecting/index.md)                      | Cells have been selected in AG Grid                                 |
| [Chart Changed](https://www.adaptabletools.com/docs/technical-reference-charts/index.md)                                  | A Chart has been displayed                                          |
| [Column Filter Applied](https://www.adaptabletools.com/docs/technical-reference-filter/index.md)                          | Column Filters have been applied                                    |
| [Column Filter Changed](https://www.adaptabletools.com/docs/technical-reference-filter/index.md)                          | A Column Filter changed (including editor drafts not yet applied)   |
| [Comment Changed](https://www.adaptabletools.com/docs/technical-reference-comments/index.md)                              | Comments have been updated                                          |
| [Custom Toolbar Configured](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md)                   | The 'configure' button is clicked in a Custom Toolbar               |
| [Dashboard Changed](https://www.adaptabletools.com/docs/technical-reference-dashboard/index.md)                           | Something has changed in the Dashboard                              |
| [Data Imported](https://www.adaptabletools.com/docs/technical-reference-importing/index.md)                               | The Data Import wizard has finished                                 |
| [DataSet Selected](https://www.adaptabletools.com/docs/technical-reference-data-set/index.md)                             | A new DataSet has been selected                                     |
| [FDC3 Message](https://www.adaptabletools.com/docs/technical-reference-fdc3/index.md)                                     | An FDC3 Message has been sent or received                           |
| [Flashing Cell Displayed](https://www.adaptabletools.com/docs/technical-reference-flashing-cell/index.md)                 | A Flashing Cell has flashed                                         |
| [Grid Filter Applied](https://www.adaptabletools.com/docs/technical-reference-filter/index.md)                            | A Grid Filter has been applied                                      |
| [Grid Sorted](https://www.adaptabletools.com/docs/technical-reference-custom-sorting/index.md)                            | A Column in AdapTable has been sorted                               |
| [Layout Changed](https://www.adaptabletools.com/docs/technical-reference-layouts/index.md)                                | A Layout has changed or been selected                               |
| [Live Data Changed](https://www.adaptabletools.com/docs/technical-reference-exporting/index.md)                           | Something happens related to the AdapTable 'live reports'           |
| [Note Changed](https://www.adaptabletools.com/docs/technical-reference-notes/index.md)                                    | A Note has been added, edited or deleted                            |
| [Report Schedule Ran](https://www.adaptabletools.com/docs/technical-reference-exporting/index.md)                         | A Report Schedule has run                                           |
| [Row Changed](https://www.adaptabletools.com/docs/technical-reference-managing-grid-data/index.md)                        | Rows have been added, updated or deleted in AG Grid                 |
| [Row Form Submitted](https://www.adaptabletools.com/docs/technical-reference-row-form/index.md)                           | A Row Form has been submitted (or Delete button clicked)            |
| [Row Selection Changed](https://www.adaptabletools.com/docs/technical-reference-selecting/index.md)                       | Rows have been selected in AG Grid                                  |
| [System Status Message Displayed](https://www.adaptabletools.com/docs/technical-reference-system-status-message/index.md) | A new System Status Message has been displayed                      |
| [Team Sharing Entity Changed](https://www.adaptabletools.com/docs/technical-reference-team-sharing/index.md)              | An Active Shared Entity in Team Sharing has changed                 |
| [Theme Selected](https://www.adaptabletools.com/docs/technical-reference-theming/index.md)                                | A Theme has been selected                                           |

## Event API

The [`EventApi`](https://www.adaptabletools.com/docs/reference/eventapi.md) section of [Adaptable API](https://www.adaptabletools.com/docs/technical-reference-adaptable-api/index.md) subscribes to and publishes Adaptable Events:

| Method | Returns | Description |
| --- | --- | --- |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from GridSorted |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from RowSelectionChanged |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from ThemeSelected |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from SystemStatusMessageDisplayed |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from AlertFired |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from DataImported |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from FlashingCellDisplayed |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from LayoutChanged |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from CalculatedColumnChanged |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from CustomToolbarConfigured |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from GridFilterApplied |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from DashboardChanged |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from BeforeAdaptableStateChange |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from AdaptableStateChanged |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from AdaptableStateReloaded |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from LiveDataChanged |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from RowFormSubmitted |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from DataSetSelected |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from ChartChanged |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from CommentChanged |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from NoteChanged |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from ReportScheduleRan |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from AdaptableDestroy |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from AdaptableReady |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from Fdc3Message |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from ColumnFilterChanged |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from ColumnFilterApplied |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from CellChanged |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from RowChanged |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from TeamSharingEntityChanged |
| [off(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#off) | `void` | Unsubscribe from CellSelectionChanged |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired whenever AdapTable is Sorted |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired whenever the Row **Selection in AdapTable changes**. |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired whenever a shipped theme (`light`, `dark`, or `os`) is selected or re-applied |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired whenever a **System Status Message is displayed** in AdapTable |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired whenever an **Alert is triggered** in AdapTable. |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired when **Data has been imported** |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired whenever **Cell Flashing** is triggered in AdapTable. |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired whenever the current Layout updates in AdapTable |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired whenever a Calculated Columns is created / updated / deleted in AdapTable |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired whenever **Configure Button is clicked in a Custom Toolbar** |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired whenever a Grid Filter is applied in AdapTable |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired whenever **Dashboard State changes**<br/>Primarily used for rendering Custom toolbars. |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `() => void` | Event fired **before** Adaptable State changes (before the action is processed) |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `() => void` | Event fired whenever **Adaptable State changes** |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `() => void` | Event fired whenever **Adaptable State is reloaded** |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `() => void` | Event fired whenever **a change occurs relating to live reports / data**<br/>Used in conjunction with AdapTable&#39;s partners OpenFin or ipushpull |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `() => void` | Event fired when a Row Form is submitted |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `() => void` | Event fired when a DataSet is Selected |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `() => void` | Event fired when a Chart is Changed |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `() => void` | Event fired when a Comment is Changed |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired whenever a Note is added, edited or deleted in AdapTable |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired whenever a Schedule is triggered in AdapTable |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Fired when Adaptable is up and running - has no arguments. |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Fired when Adaptable is destroyed |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `() => void` | Event fired when an FDC3 message is sent(Raise Intent or Broadcast Context) or received (Intent or Context) |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired whenever a Column Filter changes in AdapTable — including<br/>incomplete editor drafts that are not yet applied. |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired whenever a Column Filter is Applied in AdapTable (persisted;<br/>grid filtering may run). Prefer ColumnFilterChanged + `isApplied` for new code. |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired whenever a cell changes in the Grid |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired when a row is added, deleted or updated in the Grid |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired whenever a Shared Entity in Team Sharing changes |
| [on(eventName, callback)](https://www.adaptabletools.com/docs/reference/eventapi.md#on) | `VoidFunction` | Event fired whenever the Cell **Selection in AdapTable changes**. |
