Pre-Edit Validation
Summary
- AdapTable allows developers to specify which columns / cells in AG Grid are editable and which are read-only
- Both editable and read-only cells can be specifically styled for easy identification
AdapTable provides Pre-Edit validation - which prevents read-only cells from being edited.
Note
- Read-only and editable cell evaluation is performed on the current cell value, i.e. before any cell editing happens
- This is different to Client Validation and Server Validation which both evaluate the proposed new cell value
AdapTable fully respects as read-only any Column Definitions configured with editable as false in AG Grid GridOptions (including if editability is set via a function).
But sometimes a more granular or dynamic approach is required, where the editability of each cell in the same column is dependent on its value (or other data in the same row).
Hint
Although AdapTable respects editability set in an AG Grid column definition, we advise using the function below instead
Setting Editable Cells
The isCellEditable function in Edit Options enables editability evaluation to be made on a per-cell basis.
isCellEditable
Caution
This takes precedence over the colDef.editable property in GridOptions
Find Out More
See the Developer Tutorial on Setting Cell Editability for more details on how AdapTable evaluates cell editability
Styling Editable / ReadOnly Cells
When using the isCellEditable function, you might wish also to visually indicate to your users which Cells in AG Grid are editable.
Use editableCellStyle and readOnlyCellStyle in User Interface Options to achieve this.
Find Out More
See Styling Editable Cells and the UI Guide for ReadOnly, Editable and Edited Cell Styles for examples
- Three read-only rules in
adaptableOptions.tsviaisCellEditablein Edit Options:- No cell in any row where
languageis HTML is editable github_starsis not editable when the value is over 20,000nameis not editable whereweek_issue_changeis negative
- No cell in any row where
readOnlyCellStylein User Interface Options adds a brown border and radius on read-only cells