# Setting Cell Editability

Canonical page: https://www.adaptabletools.com/docs/dev-guide-tutorial-setting-cell-editability

- 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.:

- When the user starts editing a cell directly
- Rendering the [ReadOnly or Editable Cell Styles](https://www.adaptabletools.com/docs/ui-tutorial-editable-styles/index.md)
- Providing the [Smart Edit](https://www.adaptabletools.com/docs/handbook-editing-smart-edit/index.md) or [Bulk Update](https://www.adaptabletools.com/docs/handbook-editing-bulk-update/index.md) menu items for the [Context Menu](https://www.adaptabletools.com/docs/ui-context-menu/index.md)
- When opening a [Row Form](https://www.adaptabletools.com/docs/handbook-row-form/index.md) field

## 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)

- 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](https://www.adaptabletools.com/docs/handbook-validating-pre-edit/index.md#setting-editable-cells) function in [Edit Options](https://www.adaptabletools.com/docs/technical-reference-editing/index.md)

## AdapTable Rules of Evaluation

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

**First it will evaluate** the [isCellEditable](https://www.adaptabletools.com/docs/handbook-validating-pre-edit/index.md#setting-editable-cells) 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.

- 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`)
