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 cells from being validated which are read-only.

Note

  • Read-only & Editable cell evaluation is performed on the current cell value, ie. before any cell editing happens
  • This is different to Client Validation and Server Validation which both evaluate on 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 editablity 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

Function which sets if a cell is editable

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 the editableCellStyle and readOnlyCellStyle functions in User Interface Options to achieve this.

Find Out More

See Styling Editable & ReadOnly Cells for more information and accompanying examples

Editable Cells
Fork
  • This example contains 3 Read-Only cell Rules - set using isCellEditable property in Edit Options:
    • No cell in any row where Language cell value is HTML is editable
    • GitHub Stars is not editable for cells with a value over 20,000
    • Name column is not editable where Issue Change is negative
  • Additionally a readOnlyCellStyle of a brown border with a radius has been set in User Interface Options to enable non-editable cells to be readily identified

Expand to see the Adaptable Options code