Row Change Alerts
Summary
- Row Change Alerts are Alerts which can be fired when the Rows in the Grid change
- This can be either when:
- a new Row is added to AG Grid
- an existing Row is deleted from AG Grid
AdapTable offers 2 Alerts which fire in response to changes in the number of rows in AG Grid's data source:
ROW_ADDED- wraps the ROW_ADDED Observable Expression FunctionROW_REMOVED- wraps the ROW_REMOVED Observable Expression Function
Note
These are both specialised types of Observable Alert which look for changes in the Grid or given rows
Caution
When defining the Alert in Initial State, the Scope in the Alert Definition should be set to All
Added Row Alert
The ROW_ADDED Expression can be used to create an Observable Alert which will fire each time a new row is added to AG Grid.
Hint
- If adding the new row programatically, use Grid API's'
addGridDatafunction (see Managing Row Data for more info) - Don't directly use
applyTransaction(orapplyTransactionAsync) in AG Grid's API as it bypasses new row detection
- This demo has a
ROW_ADDEDAlert which fires when a now 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
Because ROW_ADDED is an Observable Alert, it can be provided with an additional WHERE clause.
This specifies when the Alert should fire (ie. what extra requirement is available)
Caution
- If creating a Conditional Row Changed Alert in the UI, you will need to select the, fuller, Observable Alert option
- This option contains a stop that renders the Expression Editor which is where the
WHEREclause can be added
- This demo contains an Add Row Warning Alert but the Rule has a
WHEREclause in the Expression, specifying the Alert should only fire when the new Row:- has a
Languageof TypeScript - and
Has Wikiis true
- has a
- 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' forLanugageand checkHas Wikiand click Save - The new Row will be added to the Grid and the Alert will fire
Removed Row Alert
Another commonly used Observable Alert requirement is row removal, ie. to fire an Alert when rows have been from the Grid.
The ROW_REMOVED Expression can be used to create an Observable Alert which will fire each time a Row is removed from AG Grid.
- This example fires a
ROW_REMOVEDObservable Alert 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