Alerts Technical Reference
Summary
- Alerts are configured i the Alert section of Adaptable State
- Alert Options contains many properties to enable fine-tuned configuring of Alerts
- Run-time access to Alerts is primarily available through Alert API
- The Alert Fired event is published every time an Alert is fired in AdapTable
Alert State
The Alert section of Adaptable State contains a collection of AlertDefinition objects:
| Property | Description |
|---|---|
| AlertDefinitions | Alert Definitions - will trigger Alerts when rule is met |
Alert Definition
Each Alert Definition is defined as follows:
| Property | Description |
|---|---|
| AlertForm | Form to display in Alert with buttons and inputs |
| AlertProperties | Series of properties which set what happens when Alert is triggered |
| MessageHeader | Title of displayed Alert Message |
| MessageText | Title of displayed Alert Message; if null, AdapTable creates dynamically using Rule & Scope |
| MessageType | Type of Alert: 'Info', 'Success', 'Warning', 'Error'; influences Alert colour, icon and logging |
| Name | Name of the Alert Definition |
| Rule | When Alert should be triggered |
| Scope | Where Alert can be triggered: one, some or all columns or DataTypes |
| IsReadOnly | Sets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full') |
| IsSuspended | Suspends (i.e. turns off) an Adaptable Object |
Alert Properties
The Alert Properties object defines some optional behaviour for the Alert:
| Property | Description | Default |
|---|---|---|
| DisplayNotification | Displays a notification when Alert is triggered | |
| HighlightCell | Colours updated Row using MessageType of triggering Alert Definition | |
| HighlightRow | Colours updated Row using MessageType of triggering Alert Definition | |
| JumpToCell | Grid will 'jump' to the changed cell which triggered the Alert | |
| JumpToRow | Grid will 'jump' to the newly added row which triggered the Alert | |
| LogToConsole | Logs the Alert message to the console | |
| NotificationDuration | Notifiction duration(defaults to NotificationOptions.duration) | |
| PreventEdit | Automatically prevent any cell edit which triggered the Alert (i.e. validation) | false |
| ShowInDiv | Shows Alert text in the div specificed in alertContainer property of Container Options |
Alert Options
| Property | Description | Default |
|---|---|---|
| alertForms | Full definitions of Alert Forms - the names of which are provided in Alert State | |
| alertMessageHeader | Function providing Header to display in Alert; if empty, AdapTable provides dynamically | |
| alertMessageText | Function providing Message to display in Alert; if empty, AdapTable provides dynamically | |
| cellHighlightDuration | How long (in ms) a Cell will be highlighted when an Alert fires | 2000 |
| commandHandlers | Custom onClick Handlers for Buttons (displayed in Alert Forms) | |
| dataChangeDetectionPolicy | Whether Alert rule is evaluated against the rawValue or formattedValue of the changed cell data | 'rawValue' |
| maxAlertsInStore | How many alerts held in State at any one time; when limit is breached, oldest alert will be removed | 20 |
| rowHighlightDuration | How long (in ms) a Row will be highlighted when an Alert Fires | 4000 |
| showMissingPrimaryKeyAlert | Shows Alert if Primary Key column in Adaptable Options is not present or incorrect | false |
| statusbarHighlightDuration | How long (in ms) Alert panel in Status Bar highlights when an Alert Fires | 2000 |
Alert API
Full programmatic access to Alerts and related features is available in Alert API.
This enables Alerts to be accessed, created, edited, deleted and shared programmatically.
| Method | Description |
|---|---|
| addAlertDefinition(alertDefinition) | Adds given Alert Definition to Adaptable State |
| deleteAlertDefinition(alertDefinition) | Deletes given Alert Definition from Adaptable State |
| displayAdaptableAlert(alertToShow) | Displays the given Adaptable Alert |
| displayAdaptableAlertNotification(alert) | Displays given Alert as a Toast |
| editAlertDefinition(alertDefinition) | Updates given Alert Definition in Adaptable State |
| evaluateAlertDefinitions(alertDefinitions) | Evaluates the given Alert Definitions - will fire Alert if rule is met |
| findAlertDefinitions(alertLookupCriteria) | Find all Alert Definitions which match the given criteria |
| getActiveAlertDefinitions(config) | Retrieves all Alert Definitions which are currently active |
| getAlertDefinitionById(id, config) | Retrieves alert definition by the technical ID (from AlertState) |
| getAlertDefinitionByName(name) | Retrieves an Alert Definition by its Name |
| getAlertDefinitions(config) | Retrieves all Alert Definitions in Alert State |
| getAlertState() | Retrieves Alert section from Adaptable State |
| getSuspendedAlertDefinitions(config) | Retrieves all Alert Definitions which are currently suspended |
| openAlertSettingsPanel() | Opens Settings Panel with Alert section selected and visible |
| showAlert(alertHeader, alertMessage, messageType, alertProperties) | Creates Alert based on given parameters and displays it. |
| showAlertError(alertHeader, alertMessage) | Creates an Adaptable Alert based on given parameters and displays it as Error Alert. |
| showAlertInfo(alertHeader, alertMessage) | Creates an Adaptable Alert based on given parameters and displays it as Info Alert. |
| showAlertSuccess(alertHeader, alertMessage) | Creates an Adaptable Alert based on given parameters and displays it as Succcess Alert. |
| showAlertWarning(alertHeader, alertMessage) | Creates an Adaptable Alert based on given parameters and displays it as Warning Alert. |
| suspendAlertDefinition(alertDefinition) | Suspends Alert Definition |
| suspendAllAlertDefinition() | Suspends all Alert Definitions |
| unSuspendAlertDefinition(alertDefinition) | Activates a suspended Alert Definition |
| unSuspendAllAlertDefinition() | Activates all suspended Alert Definition |
Alert Fired Event
The Alert Fired Event is published by AdapTable whenever an Alert is fired.