Alerts Technical Reference

View as Markdown

Alert State

AlertState

Alert section of Adaptable State, including Initial State.

Each definition fires when its condition is met. A rule-based alert sets Scope and Rule. A row-change alert sets RowChangeTrigger ('Added' or 'Removed'). A scheduled alert sets Schedule and has no rule. MessageType sets the colour and icon. MessageHeader is the title and MessageText is the body.

Extends

BaseState

Alerts to evaluate. Each one is a rule-based alert (Scope + Rule), a row-change alert (RowChangeTrigger), or a scheduled alert (Schedule).

Rule Based Alert Definition

RuleBasedAlertDefinition

Alert that fires when data matches a rule in the given column scope

AlertDefinitionBase

Fields every alert definition has.

Name identifies the alert. MessageType is required and sets the colour, icon and log level ('Info', 'Success', 'Warning' or 'Error'). MessageHeader is the notification title. MessageText is the body. Suspend with IsSuspended.

Title of displayed Alert Message

Body of the displayed alert. The title is .

Tokens such as the column and the old and new values are substituted when the alert fires. When omitted, a rule-based alert uses the scope and the rule, and a row-change alert uses a count of the rows that were added or removed. alertOptions.alertMessageText overrides this text when it returns a string.

Type of Alert: 'Info', 'Success', 'Warning', 'Error'; influences Alert colour, icon and logging

Name

string

Name of the Alert Definition

Alert category. When omitted, inferred from Rule or Schedule. See .

IsReadOnly?

boolean

Sets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full')

IsSuspended?

boolean

Suspends (i.e. turns off) an Adaptable Object

Form to display in Alert with buttons and inputs

Properties which set what happens when the Alert is triggered (notification and grid behaviours)

Rule

string

AdapTableQL boolean expression deciding when the Alert is triggered.

The kind is inferred from the text: a per-row rule such as
[price] > 100, an aggregated rule such as SUM{[notional]} > 1000000,
or a live (observable) rule such as CHANGE_COUNT{[price], WITHIN(5m)} >= 3.

Where Alert can be triggered: one, some or all columns or DataTypes

When a live rule (one reading change history — CHANGE_COUNT[price],
WITHIN(5m) = 3 — or the clock) fires. Live rules are re-evaluated on
data changes and on window expiry alike, and fire only on the transition
from false to true (per row, or once for a grid-level rule). Ignored for
every other rule.

IsReadOnly?

boolean

Sets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full')

IsSuspended?

boolean

Suspends (i.e. turns off) an Adaptable Object

Alert Properties

RuleAlertProperties

Properties for rule-based alerts (presentation plus grid behaviours)

AlertPresentationProperties

Notification properties shared by rule-based and scheduled alerts

Displays a notification when Alert is triggered

Shows the alert message in the System Status panel

LogToConsole?

boolean

Logs the Alert message to the console

How long the notification stays visible. When omitted, notificationsOptions.duration is used.

ShowInDiv?

boolean

Shows the alert text in the element named by containerOptions.alertContainer

Colours the cell that triggered the alert. true uses the colour for MessageType. An is applied instead of that colour.

Colours the row that triggered the alert. true uses the colour for MessageType. An is applied instead of that colour.

JumpToCell?

boolean

Grid will 'jump' to the changed cell which triggered the Alert

JumpToRow?

boolean

Grid will 'jump' to the newly added row which triggered the Alert

PreventEdit?

boolean

Automatically prevent any cell edit which triggered the Alert (i.e. validation)

Default

false

TriggerPolicy is an AlertTriggerPolicy:

AlertTriggerPolicy

Firing policy of a live (observable / clock-reading) alert rule.

FireOn?

'BecomeTrue'

'BecomeTrue' (the only policy, and the default): fire when the rule
turns from false to true; stay silent while it remains true; a rule that
is already true when the Alert is created does not fire until it turns
false and true again.

Scope is a Column Scope:

ColumnScope

Which columns an object applies to. Set exactly one shape.

One of

Matches every column. All must be true.

{ DataTypes }

('text' | 'number' | 'boolean' | 'date' | 'textArray' | 'numberArray')[]

Data types to match, for example ['number'] or ['text', 'textArray']. Object, tuple and unknown columns are not scope data types. Name those columns with ColumnIds.

Column ids to match. These are AG Grid colId values.

AG Grid column type names, the strings set on colDef.type.

Schedule Based Alert Definition

ScheduledAlertDefinition

Alert that fires on a schedule (no rule or column scope)

AlertDefinitionBase

Fields every alert definition has.

Name identifies the alert. MessageType is required and sets the colour, icon and log level ('Info', 'Success', 'Warning' or 'Error'). MessageHeader is the notification title. MessageText is the body. Suspend with IsSuspended.

Title of displayed Alert Message

Body of the displayed alert. The title is .

Tokens such as the column and the old and new values are substituted when the alert fires. When omitted, a rule-based alert uses the scope and the rule, and a row-change alert uses a count of the rows that were added or removed. alertOptions.alertMessageText overrides this text when it returns a string.

Type of Alert: 'Info', 'Success', 'Warning', 'Error'; influences Alert colour, icon and logging

Name

string

Name of the Alert Definition

Alert category. When omitted, inferred from Rule or Schedule. See .

IsReadOnly?

boolean

Sets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full')

IsSuspended?

boolean

Suspends (i.e. turns off) an Adaptable Object

Notification properties for scheduled alerts (no grid behaviours)

When the alert should run

IsReadOnly?

boolean

Sets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full')

IsSuspended?

boolean

Suspends (i.e. turns off) an Adaptable Object

Alert Properties

ScheduledAlertProperties

Properties for scheduled alerts (notification only)

AlertPresentationProperties

Notification properties shared by rule-based and scheduled alerts

Displays a notification when Alert is triggered

Shows the alert message in the System Status panel

LogToConsole?

boolean

Logs the Alert message to the console

How long the notification stays visible. When omitted, notificationsOptions.duration is used.

ShowInDiv?

boolean

Shows the alert text in the element named by containerOptions.alertContainer

When true, the scheduled notification includes a Suspend button

Schedule

Schedule

When a scheduled alert or export runs.

IsOneOff: true runs once at RunAt (an ISO date-time). IsOneOff: false repeats on CronExpression, a 5-field cron (minute, hour, day of month, month, day of week). Weekdays in that cron are 0–6 with Sunday as 0; 1-5 is Monday to Friday.

Standard 5-field cron (minute hour day-of-month month day-of-week); e.g. weekdays at 09:30 → 30 9 * * 1-5

IsOneOff

boolean

true runs once, at RunAt. false repeats on CronExpression.

RunAt?

string

ISO datetime for a one-off run (local time); set when IsOneOff is true


Alert Options

AlertOptions

Options related to Alerts in Adaptable.

Full definitions of Alert Forms - the names of which are provided in Alert State

alertMessageHeader?

(alertMessageContext:AlertMessageContext<TData>) => string | undefined

Function providing Header to display in Alert; if empty, AdapTable provides dynamically

alertMessageText?

(alertMessageContext:AlertMessageContext<TData>) => string | undefined

Function providing Message to display in Alert; if empty, AdapTable provides dynamically

How long (in ms) a Cell will be highlighted when an Alert fires

Default

2000

Custom onClick Handlers for Buttons (displayed in Alert Forms)

When a single batch action (e.g. Bulk Update, Smart Edit) triggers multiple Alerts from the
same Alert Definition, consolidate them into a single Alert (with an occurrence count) rather
than showing one Alert per changed cell.

Per-cell effects (cell/row highlighting, console logging, the AlertFired event) still fire
for every change; only the "once" effects (the stored Alert, the toast notification and any
jump-to-cell/row) are consolidated. Alerts that use a bespoke Alert Form are never consolidated.

Default

true

Whether Alert rule is evaluated against the rawValue or formattedValue of the changed cell data

Default

'rawValue'

How many alerts held in State at any one time; when limit is breached, oldest alert will be removed

Default

20

How long (in ms) a Row will be highlighted when an Alert Fires

Default

4000

Shows Alert if Primary Key column in Adaptable Options is not present or incorrect

Default

false

How long (in ms) Alert panel in Status Bar highlights when an Alert Fires

Default

2000

dataChangeDetectionPolicy is a DataChangeDetectionPolicy:

Value
'rawValue'
'formattedValue'

alertForms entries are { name: string; form: AdaptableForm }. The form callback receives an AlertFormContext:

The form is an AdaptableForm:

AdaptableForm

Expand

Defines the form. fields is a list of fields, rows of fields, or field groups. buttons are the form buttons. layout is rows (the default) or inline.

AdaptableForm

Defines a form which appears dynamically; used by Alerts, Export Custom Destinations and Dashboard Custom Toolbars.

Buttons to include in the Form

Additional information to appear in the Form

Collection of Dynamic Fields and Field Groups to display.

Items can be:
- a single (rendered on its own row in the
default rows layout, or as one cell in the inline layout),
- an array of (rendered side-by-side on the
same row in the rows layout), or
- an (a labelled section that
visually groups related fields).

How the form's fields are arranged on screen.

- rows (default): each field on its own row, label on the left and
input on the right. Suitable for popups / wizards.
- inline: fields are placed side-by-side on a single horizontal line,
with the label rendered immediately before its input. Designed for
compact contexts such as Dashboard Custom Toolbars where vertical
real-estate is scarce.

Default

'rows'

onSubmit?

(formData: TData, context: T) => void

Optional form-level submit hook.

Fired when the user presses Enter while focus is inside any field
input AND the form is currently valid. The full formData is passed
through, typed as TData if you've supplied a custom shape.

Use this as an ergonomic shortcut to avoid wiring an explicit "Submit"
button - or in addition to one, so power users can press Enter to
commit. If the form is invalid the hook is not invoked.

title?

string

Title to appear in the Form

Each field is an AdaptableFormField:

AdaptableFormField

Defines a Field that appears in an Adaptable Form

For single select fields only. When the user clears the combobox,
whether to restore instead of leaving the field empty.

Defaults to true when defaultValue is set, otherwise false.
Set to false when an empty selection is a distinct state from the default.

defaultValue?

string | boolean | number | Array<string | number | boolean>

Field Default Value - can be of type string, boolean, number, or for
select fields with multi: true an array of those.

For single select fields, this is also the value restored when the user
clears the combobox (unless is false).

disabled?

boolean | ((formData:AdaptableFormData, context:BaseContext) => boolean)

Disable the field's input. Either a boolean or a function evaluated
against the current form data. Disabled fields render but the user
cannot edit them.

Field Type - dictates which UI control is rendered

helpText?

string

Inline help text rendered immediately below the field's input. Useful
for short explanations such as "format: YYYY-MM-DD" or "min 3 chars".

hidden?

boolean | ((formData:AdaptableFormData, context:BaseContext) => boolean)

Hide the field. Either a boolean or a function evaluated against the
current form data. Hidden fields are not rendered and are excluded from
validation.

label

string

Label to display in the Field

max?

number | string

Maximum allowed value. For number and slider: the highest accepted
number. For date, time and datetime: the latest allowed value in
ISO format.

maxLength?

number

Maximum length for text and textarea fields.

min?

number | string

Minimum allowed value. For number and slider: the lowest accepted
number. For date, time and datetime: the earliest allowed value
in ISO format (YYYY-MM-DD / HH:mm / YYYY-MM-DDTHH:mm).

minLength?

number

Minimum length for text and textarea fields.

multi?

boolean

For select fields only. When true the field renders as a
multi-select combobox; the field's value is an array of selected
option.values rather than a single value.

Default

false

name

string

Name of the Field

onValueChange?

(value: any, context:BaseContext) => void

Optional callback invoked whenever value of this field changes

Items to populate the select and radio fieldTypes.

Either a static array, or a function that derives the options from the
current form data and Adaptable context. The function form may return
a Promise for asynchronously-loaded options - the form will render the
field with no items until the promise resolves.

pattern?

string

Regular expression that the value of a text field must match.

Placeholder text shown inside text, textarea, number, date,
time and datetime inputs when empty. For select fields it is
rendered as the empty-state label when no value is selected.

When omitted on a select field with a , the label of
the matching options entry is used as the empty-state label.

render?

(params:AdaptableFormFieldRenderParams) => React.ReactNode

For custom fields only. Renders an arbitrary React node as the
field's input. Receives the current value, a setValue setter
(controlled), the current form data, the Adaptable context and the
resolved disabled state.

Use this as an escape hatch when none of the built-in fieldTypes
fit - e.g. to render a star-rating widget, a tag editor or any
bespoke control.

required?

boolean

If true the field is treated as required. An empty value ('',
null, undefined, or unchecked checkbox) will produce a validation
error.

rows?

number

For textarea fields: the visible number of text rows.

Default

3

step?

number

Stepping interval for number, slider, time and datetime
fields.

tooltip?

string

Tooltip shown when hovering the field's label.

validate?

(value: any, formData:AdaptableFormData, context:BaseContext) => string | null | undefined

Custom field-level validation. Return an error message string to mark
the field invalid, or null/undefined if the value is valid.

Custom validation runs after built-in checks (required, min,
max, pattern, etc.) - the first failing check wins.

fieldType is an AdaptableFormFieldType:

Value
'text'
'textarea'
'select'
'radio'
'date'
'time'
'datetime'
'number'
'slider'
'color'
'checkbox'
'textOutput'
'custom'

Select and radio options are AdaptableFormFieldOption objects:

AdaptableFormFieldOption

One choice in a select or radio form field.

label

string

Text shown for this choice.

Value written into the form data when this choice is selected.

layout is an AdaptableFormLayout:

Value
'rows'
'inline'

buttons are AdaptableButton objects:

AdaptableButton

A button on a form, alert or toolbar.

label is the text. onClick runs when it is clicked and receives the button and the form or event context. buttonStyle and icon are optional. disabled and hidden are functions that return whether the button is disabled or hidden.

buttonStyle?

ButtonStyle| ((button:AdaptableButton<CONTEXT_TYPE>, context: CONTEXT_TYPE) =>ButtonStyle)

Style for Button - can be object or function that provides a ButtonStyle object

disabled?

(button:AdaptableButton<CONTEXT_TYPE>, context: CONTEXT_TYPE) => boolean

Function that disables / enables the button based on its evaluation result

hidden?

(button:AdaptableButton<CONTEXT_TYPE>, context: CONTEXT_TYPE) => boolean

Function which sets whether Button is hidden

icon?

AdaptableIcon| ((button:AdaptableButton<CONTEXT_TYPE>, context: CONTEXT_TYPE) =>AdaptableIcon)

Icon for Button - can be object or function that provides a AdaptableIcon object

iconPosition?

'start' | 'end'

Where the icon appears relative to the label

Default

'start'

label?

string | ((button:AdaptableButton<CONTEXT_TYPE>, context: CONTEXT_TYPE) => string)

Label for Button - can be string or function that provides string

onClick?

(button:AdaptableButton<CONTEXT_TYPE>, context: CONTEXT_TYPE) => void

Function to invoke when button is clicked

tooltip?

string | ((button:AdaptableButton<CONTEXT_TYPE>, context: CONTEXT_TYPE) => string)

Tooltip for Button - can be string or function that provides string

buttonStyle is a ButtonStyle:

ButtonStyle

Appearance of an AdapTable button.

variant is 'text', 'outlined' (the default) or 'raised'. tone is the colour: 'neutral' (the default), 'success', 'error', 'warning', 'info', 'accent' or 'none'. className adds a CSS class.

className?

string

CSS Classname to use for the Button

tone?

'success' | 'error' | 'neutral' | 'none' | 'warning' | 'info' | 'accent'

Button's Tone - values: 'success', 'error', 'neutral', 'none', 'warning', 'info', 'accent'

Default

'neutral'

variant?

'text' | 'outlined' | 'raised'

How Button appears - values: 'text', 'outlined', 'raised'

Default

'outlined'

commandHandlers entries are { name: string; handler: (button, context: AlertFormContext) => void }.


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.

AlertApi

Alert Definitions and fired alerts: read, edit, suspend, evaluate and display them.

Adds given Alert Definition to Adaptable State

Fires a scheduled Alert Definition now: its notification, system status message, or other behaviour.

Deletes given Alert Definition from Adaptable State

Displays the given Adaptable Alert.

Displays given Alert as a Toast

Updates given Alert Definition in Adaptable State

Evaluates the given Alert Definitions - will fire Alert if rule is met

Find all Alert Definitions which match the given criteria

Alert Definitions that are currently active (not suspended).

Retrieves alert definition by the technical ID (from AlertState)

Retrieves an Alert Definition by its Name

Retrieves all Alert Definitions in Alert State

getAlertRuleState(alertDefinition, rowNode)
returns

'Normal' | 'Firing' | undefined

Current reading of a live Alert rule — one reading change history
(CHANGE_COUNT{[price], WITHIN(5m)} >= 3) or the clock. 'Firing' while
the rule holds for rowNode (per-row rules) or for the grid (grid-level
rules; rowNode ignored); 'Normal' otherwise. undefined for
non-live, suspended or never-evaluated definitions / rows.

Retrieves Alert section from Adaptable State

Alert Definitions that are currently suspended.

Opens the Settings Panel on the Alert page.

The Alert page has two tabs: 'Alerts' (the live / triggered alerts) and
'Alert Definitions' (the alert configuration). Pass tab to open a specific tab.
When omitted, it opens the 'Alerts' tab if there are any live alerts, otherwise the
'Alert Definitions' tab.

Creates Alert based on given parameters and displays it.

Creates an Adaptable Alert based on given parameters and displays it as Error Alert.

Creates an Adaptable Alert based on given parameters and displays it as Info Alert.

Creates an Adaptable Alert from the header and message and displays it as a Success alert.

Creates an Adaptable Alert based on given parameters and displays it as Warning Alert.

Suspends all Alert Definitions

Activates a suspended Alert Definition

Activates all suspended Alert Definition


Alert Fired Event

The Alert Fired Event is published by AdapTable whenever an Alert is fired.

The event comprises the AlertFiredInfo object which contains a single property:

AlertFiredInfo

Payload of the AlertFired event.

Fires when an Alert is displayed.

Extends , so adaptableApi is included.

Alert that was displayed.

A cell or row Alert includes the change that triggered it. A generic Alert is the message only.

Custom application Context provided in AdaptableOptions.adaptableContext

This is of type AdaptableAlert which has 2 flavours:

  • Cell Changed Alert
  • Row Changed Alert

Cell Changed Alert

This is fired when a Cell in AdapTable is changed — either manually or via ticking data.

It is of type AdaptableCellChangedAlert and contains a single cellDataChangedInfo property:

AdaptableCellChangedAlert

Defines an Alert fired by AdapTable when a cell is changed

Extends

AdaptableAlertBase<'cellChanged'>

Cell DataChange which triggered Alert

For a consolidated batch Alert this is the first affected cell (jump-to-cell lands here).

All cell changes represented by this Alert when several changes from one batch
action were consolidated (occurrenceCount 1). The first entry matches
.

Used so cell / row highlighting still applies to every affected cell.

This property is of type CellDataChangedInfo and contains full details of the Cell Change:

CellDataChangedInfo

Defines a Cell Edit - includes full details of old and new values, the column and the enclosing Row

changedAt

number

Timestamp of change occurrence (in milliseconds)

Column in which cell is situated

Value after the change.

Absent when trigger is live.

Value before the change.

Absent when trigger is live.

preventEdit?

boolean

Whether the change was prevented by a validation rule

Primary Key Column's value for the row where edited cell is situated

rowData?

TData

Data in the Row

rowNode?

IRowNode<TData>

AG Grid RowNode that contains the cell

trigger?

'edit' | 'tick' | 'undo' | 'aggChange' | 'calculatedColumnChange' | 'live'

What triggered the change - user, background change, a reverted change, a
derived update on a Calculated Column whose source value changed, or a
live Alert rule turning true for the row (live: no old / new value,
column is the rule's first Scope column when it has one).

Row Changed Alert

This is fired when a Row in AdapTable has been added, updated or deleted.

It is of type AdaptableRowChangedAlert and contains a single rowDataChangedInfo property:

This property is of type RowDataChangedInfo and contains full details of the Row in question:

rowTrigger is a RowDataChangeTrigger:

Value
'Add'
'Update'
'Delete'
'Load'

Event Subscription

Subscribing to the Event is done the same way as with all Adaptable Events:

api.eventApi.on('AlertFired', (eventInfo: AlertFiredInfo) => {
    // do something with the info
});

Find Out More

See Listening to Alerts for a worked example