More Samples
Download Wijmo


The FlexGrid helps with validation in several ways:

  1. Automatic Type Coercion: When cell edits are committed, the grid automatically coerces values to match the column's data type. It also checks for nulls and empty values based on the column's isRequired property. If the data is invalid, the original cell value is restored.
  2. Data Maps: If your grids contain columns that should only allow certain input values, add a DataMap to the column to ensure users will not be able to type invalid content into the cells.
  3. Event-Based Validation: The grid raises a cellEditEnding event that allows you to check the editor's current value and cancel the edits if the new value is invalid.
  4. CollectionView-Based Validation: The grid honors the collection view's getError method to highlight invalid cells and to prevent users from entering invalid information.

The grid below demonstrates the three first items. It has a Country column with a data map that prevents users from entering invalid countries. The cellEditEnding event is used to ensure that the 'Sales' and 'Expenses' columns contain positive values: