Row Change Alerts
Summary
- Row Change Alerts fire when the set of Rows in the Grid changes
- This can be either when:
- a new Row is added to AG Grid
- an existing Row is deleted from AG Grid
AdapTable offers a dedicated Row Change Alert type for row added and removed events:
RowAdded— fires when a row is addedRowRemoved— fires when a row is removed
Each RowChange definition has 2 characteristics:
Typeis set to 'RowChange'- an optional per-row
Rule(a standard boolean Expression evaluated on the added or removed row)
Note
- Use Row Change for a straightforward alert each time a row is added or removed (
RowChangeTrigger), with an optional booleanRuleon that row - For row add/remove tied to timers, durations, burst detection, or richer WHERE-style conditions, use Observable Alerts instead — Row Change is not the same as observable row timers
Row Change Alerts fire once per matching row event.
Caution
When defining the Alert in Initial State, the Scope in the Alert Definition should be set to All
Developer Guide
Providing Row Change Alerts in Initial State
const initialState: InitialState = {
Alert: {
AlertDefinitions: [
{
Name: 'alert-row-added',
Type: 'RowChange',
RowChangeTrigger: 'Added',
MessageType: 'Success',
MessageHeader: 'Row added',
MessageText: 'A new row was added to the grid',
Scope: {
All: true,
},
AlertProperties: {
DisplayNotification: true,
HighlightRow: true,
},
},
{
Name: 'alert-row-removed',
Type: 'RowChange',
RowChangeTrigger: 'Removed',
MessageType: 'Warning',
Scope: {
All: true,
},
Rule: '[language] = "JavaScript"',
AlertProperties: {
DisplayNotification: true,
JumpToRow: true,
},
},
],
},
};Use Type: 'RowChange' and RowChangeTrigger: 'Added' or 'Removed'. Set Scope: { All: true }.
Omit Rule to fire on every matching event, or supply a boolean expression evaluated on that row (e.g. [language] = "TypeScript").
Added Row Alert
Set RowChangeTrigger to 'Added' to fire each time a new row is added to AG Grid.
Hint
- If adding the new row programmatically, use Grid API
addGridData(see Managing Row Data) - Don't directly use
applyTransaction(orapplyTransactionAsync) in AG Grid's API as it bypasses new row detection
- This demo has a Row Change Alert (
RowChangeTrigger: 'Added') which fires when a new row is added to the Grid - We added a
Highlight RowBehaviour to easily see which Row was added - The new Row can be added to the Grid in 2 ways:
- Clicking a Custom Dashboard button that then invokes the
addGridDatamethod in Grid API - Providing an Action Column Command button of
createwhich opens the Create Row Form
- Clicking a Custom Dashboard button that then invokes the
- You can mimic adding a new Row in one of 2 ways - both of which will trigger the Alert:
- Click the
Add Python RowDashboard Button - Click the
CreateButton (which automatically displays an empty Row Form allowing you easily to add the new Row)
- Click the
Added Row Conditional Alert
The optional Rule on a Row Change Alert is a boolean Expression evaluated on the added (or removed) row. When omitted, every matching row event fires the Alert.
- This demo contains an Add Row Warning Alert with a
Rulethat limits firing to new Rows where:Languageis TypeScript- and
Has Wikiis true
- We have added a Dashboard Button which opens an Add Row Form to enable the new row to be added
- Click the 'Add New Row' Button in the Dashboard to open an Add Row Form
- Provide any
Name, select 'TypeScript' forLanguageand checkHas Wikiand click Save - The new Row will be added to the Grid and the Alert will fire
Removed Row Alert
Set RowChangeTrigger to 'Removed' to fire each time a Row is removed from AG Grid.
- This example fires a Row Change Alert (
RowChangeTrigger: 'Removed') when a row is deleted (which we do via an Action Column Commanddeletebutton) - We provided a custom message for the Alert Notification via the
alertMessageTextproperty in Alert Options
- Click the 'delete' Action Column Command button and note the Row is deleted and an Alert is fired