Setting Cell Editability

Summary

  • This tutorial describes the 2 different ways that Cell Editability can be set in AG Grid and AdapTable
  • It also explains AdapTable takes preference over AG Grid when evaluating editability

Editability Use Cases

There are many use cases when AdapTable will asses whether a given Cell in AG Grid is editable, e.g.:

Setting Readonly Columns

There are 2 main ways in which cells (or columns) can be marked as editable or readonly:

  • The colDef.editable in AG Grid GridOptions - a boolean (or boolean callback)

    Note

    • Like all ColDef properties, this defaults to false so, if not provided, the Column is readonly
    • And, like all ColDef properties, it can be set directly in each Column or by using defaultColDef
  • The isCellEditable function in Edit Options

AdapTable Rules of Evaluation

AdapTable takes account of both of these of ways to set cell editability.

First it will evaluate the isCellEditable property in Edit Options, if provided, and return the result.

If isCellEditable is not provided, AdapTable will evaluate colDef.editable in GridOptions - either as a boolean property or callback.

Hint

  • You can evaluate just a subset of columns in isCellEditable by returning context.defaultColDefEditableValue
  • This tells AdapTable to return the default editability value for the cell (i.e. what is in colDef.editable)