Row Change Alerts

View as Markdown

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 added
  • RowRemoved — fires when a row is removed

Each RowChange definition has 2 characteristics:

  • Type is 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 boolean Rule on 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,
        },
      },
    ],
  },
};
1
Set Type and RowChangeTrigger

Use Type: 'RowChange' and RowChangeTrigger: 'Added' or 'Removed'. Set Scope: { All: true }.

2
Optional Rule on the added or removed row

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 (or applyTransactionAsync) in AG Grid's API as it bypasses new row detection
Alerts: Row Added
Fork
  • This demo has a Row Change Alert (RowChangeTrigger: 'Added') which fires when a new row is added to the Grid
  • We added a Highlight Row Behaviour to easily see which Row was added
  • The new Row can be added to the Grid in 2 ways:
Try It Out
  • You can mimic adding a new Row in one of 2 ways - both of which will trigger the Alert:
    • Click the Add Python Row Dashboard Button
    • Click the Create Button (which automatically displays an empty Row Form allowing you easily to add the new Row)
Loading demo…

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.

Alerts: Row Added with Condition
Fork
  • This demo contains an Add Row Warning Alert with a Rule that limits firing to new Rows where:
    • Language is TypeScript
    • and Has Wiki is true
  • We have added a Dashboard Button which opens an Add Row Form to enable the new row to be added
Try It Out
  • Click the 'Add New Row' Button in the Dashboard to open an Add Row Form
  • Provide any Name, select 'TypeScript' for Language and check Has Wiki and click Save
  • The new Row will be added to the Grid and the Alert will fire
Loading demo…

Removed Row Alert

Set RowChangeTrigger to 'Removed' to fire each time a Row is removed from AG Grid.

Alerts: Row Removed
Fork
  • This example fires a Row Change Alert (RowChangeTrigger: 'Removed') when a row is deleted (which we do via an Action Column Command delete button)
  • We provided a custom message for the Alert Notification via the alertMessageText property in Alert Options
Try It Out
Loading demo…