The grid comes with some cell editors provided out of the box. These cell editors are listed here.
There are also some additional cell editors that are generally used
with
Example of Number Cell Editor, Date Cell Editor and Checkbox Cell Editor:
These editors are typically used with Cell Data Types.
Simple text editor that uses the standard HTML input. This editor is the default if none other specified.
cellEditorParams
available for agTextCellEditor
:
useFormatter
(boolean) If True, the editor will use the provided valueFormatter
to format the value displayed inmaxLength
(number, default: 524288) Max number of characters to allow.columnDefs = [
{
'cellEditor': 'agTextCellEditor',
'valueFormatter': "'£' + value",
'cellEditorParams': {
'useFormatter': True,
'maxLength': 200
}
# ...other props
}
]
Specified with agLargeTextCellEditor
, this is a simple editor that uses the standard HTML textarea. Best used in
conjunction with cellEditorPopup=True
.
cellEditorParams
available for agLargeTextCellEditor
:
maxLength
(number, default: 200) Max number of characters to allow.rows
(number, default: 10) Number of character rows to display.cols
(number, default: 60) Number of character columns to display.columnDefs = [
{
'cellEditor': 'agLargeTextCellEditor',
'cellEditorPopup': True,
'cellEditorParams': {
'maxLength': 100,
'rows': 10,
'cols': 50
}
# ...other props
}
]
Specified with agSelectCellEditor
, this is a simple editor that uses HTML select
.
cellEditorParams
available for agSelectCellEditor
:
values
(list) A List of values to display.columnDefs = [
{
'cellEditor': 'agSelectCellEditor',
'cellEditorParams': {
'values': ['English', 'Spanish', 'French', 'Portuguese', '(other)'],
}
# ...other props
}
]
Note on
cellEditorPopup
from the Official AG Grid Docs:Note there is no need to specify
cellEditorPopup=True
for the select cell editor, as the browser’s select widget
will appear on top of the grid.We have found the standard HTML Select doesn’t have an API that’s rich enough to play properly with the grid. When a
cell is double clicked to start editing, it is desired that the Select is a) shown and b) opened ready for selection.
There is no API to open a browsers Select. For this reason to edit there are two interactions needed 1) double click
to start editing and 2) single click to open the Select.We also observed different results while using keyboard navigation to control editing, e.g. while using Enter to start
editing. Some browsers would open the Select, others would not. This is down to the browser implementation and given
there is no API for opening the Select, there is nothing the grid can do.If you are unhappy with the additional click required, we advise you don’t depend on the browsers standard Select (ie
avoidagSelectCellEditor
) and instead useagRichSelectCellEditor
(Available in AG Grid Enterprise), or use a
custom component.
Simple number editor that uses the standard HTML number input
.
Specified with agNumberCellEditor
and configure with cellEditorParams
cellEditorParams
available for agNumberCellEditor
:
values
(list) A List of values to display.min
(number) Min allowed value.max
(number) Max allowed value.precision
(number) Number of digits allowed after the decimal point.step
(number) Size of the value change when stepping up/down, starting from min or the initial value if provided.showStepperButtons
(bool, default: False) Display stepper buttons in editor.columnDefs = [
{
'cellEditor': 'agNumberCellEditor',
'cellEditorParams': {
'min': 1,
'max': 100,
'precision': 0,
}
# ...other props
}
]
Simple date editor that uses the standard HTML date input
and works off of cell values with string
type dates.
The date format is controlled via Cell Data Types and
the Checkbox Cell Renderer. The
default is 'yyyy-mm-dd'
.
Specified with agDateStringCellEditor
and configure with cellEditorParams
.
cellEditorParams
available for agDateStringCellEditor
:
min
(string) Min allowed value. Either Date object or string in format ‘yyyy-mm-dd’.max
(string) Max allowed value. Either Date object or string in format ‘yyyy-mm-dd’.step
(number) Size of the value change when stepping up/down, starting from min or the initial value if provided.columnDefs = [
{
'cellEditor': 'agDateStringCellEditor',
'cellEditorParams': {
'min': '2000-01-01',
'min': '2019-12-31',
}
# ...other props
}
]
Simple boolean editor that uses the standard HTML checkbox input
.
Specified with agCheckboxCellEditor
.
Generally used in conjunction with
the