Columns can be marked as ReadOnly in AG Grid (by setting editable to 'false' in GridOptions) and AdapTable will respect that.
But sometimes a more granular or dynamic approach is required, where different cells in the same column can be editable or Readonly depending on row data.
For this reason AdapTable provides the isCellEditable function / property in Edit Options which allows a decision to be made on a cell by cell basis.
In this demo we have provided an implementation which contains 4 rules:
- Only rows where Ship Via is 'Federal Shipping' are editable - this uses the node object provided in the function.
- The Item Count column is not editable for cells with a value over 7 - this uses the Grid Cell object provided in the function.
- The Order Cost, Package Cost, Item Cost columns are not editable where Order Change is negative
- The Order Id is never editable
Additionally in User Interface Options you can provide a readOnlyCellStyle (or an editableCellStyle) to more clearly visually demonstrate which cells are editable or not.
In this demo we have set an editableCellStyle so that cells which can be edited display a Green border.