To enable cell editing for a column, set the editable
property on the column’s definition to True
.
columnDefs = [
{
'field': 'population',
'editable': True
}
]
To enable cell editing for all columns, set editable
to True
in the default column definitions:
defaultColDef = {'editable': True}
If Cell Data Types are enabled, the grid provides different
types of editors, with the result stored in the correct format. If disabled, simple string editing is provided, and the
result is stored as a string.
The example below shows string editing enabled on all columns by setting editable=True
and cellDataType=False
on
the defaultColDef
.
To dynamically determine which cells are editable, supply a function to the editable property on column definition.
columnDefs = [
{
'field': 'athlete',
# conditionally enables editing for data for 2012
"editable": {"function": "params.data.year == 2012"},
}
]
In the snippet above, Athlete cells will be editable on rows where the Year is 2012.