Validation Alerts
Summary
- Validation Alerts can prevent bad edits
- They will fire before the edit is committed, preventing a round trip to the server
Validation Alerts can be used to prevent cell edits which break the rule set in the Alert Definition.
This is done by specifying PreventEdit in the AlertProperties property to true.
Note
If a Prevent Edit Alert is too inflexible, an Alert with a an Undo Action can be used instead
Validation Alerts are designed to avoid this common, and extremely annoying, scenario:
- an edit is made and commmitted
- all other users of the application see this edit
- server validation then kicks in and forces the cell to 'jump back' to its initial value in all users' grids
Hint
- An alternative to validation Alerts is to create an Alert with a custom form enabling users to provide a new value
- This can be achieved via an Adaptable Form with 2 Buttons that reference Grid API methods when clicked
Alerts: Validation Alerts
- This example contains a Validation Alert which prevents a cell edit which sets
Github Starsto 0 - It is of type
Errorand displays a Notification when the Alert fires
Expand to see the Alert Definition
Try It Out
Set a GitHub Stars value to 0 and see the change being reverted and the Alert notification displayed
FAQ
How do Validation Alerts differ from ReadOnly Cells The main difference is when the evaluation is peformed:
- Use ReadOnly cells ( via
isEditableproperty in Edit Options) to validate before the edit (using the initial cell value) - Validation Alerts are evaluated after the proposed edit using the new cell value