ICellEditorComp interface allows you to create custom components for editing cell values in AG Grid. Cell editors control how users can modify data in editable cells.
Overview
Create custom cell editors to provide specialized editing experiences such as custom date pickers, color selectors, or complex data entry forms.Interface Definition
ICellEditorParams
Current value of the cell.
Key value of key that started the edit, eg ‘Enter’ or ‘F2’ - non-printable characters appear here.
Grid column.
Column definition.
Row node for the cell.
Row data.
Editing row index.
If doing full row edit, this is true if the cell is the one that started the edit (eg it is the cell the user double clicked on, or pressed a key on etc).
A reference to the DOM element representing the grid cell that your component will live inside. Useful if you want to add event listeners or classes at this level.
Utility Methods
Utility function to parse a value using the column’s
colDef.valueParser.Utility function to format a value using the column’s
colDef.valueFormatter.Callback to tell grid a key was pressed - useful to pass control key events (tab, arrows etc) back to grid.
Callback to tell grid to stop editing the current cell. Call with input parameter true to prevent focus from moving to the next cell after editing stops in case the grid property
enterNavigatesVerticallyAfterEdit=true.Runs the Editor Validation.
Required Methods
Mandatory - Return the final value. Called by the grid once after editing is complete.
Optional Methods
Optional: Gets called once after initialised. If you return true, the editor will not be used and the grid will continue editing. Use this to make a decision on editing inside the init() function.
Optional: Gets called once after editing is complete. If your return true, then the new value will not be used. The editing will have no impact on the record.
Optional: A hook to perform any necessary operation just after the GUI for this component has been rendered on the screen. This is useful for any logic that requires attachment before executing, such as putting focus on a particular DOM element.
Optional: Gets called once after initialised. If you return true, the editor will appear in a popup, so is not constrained to the boundaries of the cell.
Optional: Gets called once, only if isPopup() returns true. Return “over” if the popup should cover the cell, or “under” if it should be positioned below leaving the cell value visible.
Optional: If doing full line edit, then gets called when focus should be put into the editor.
Optional: If doing full line edit, then gets called when focus is leaving the editor.
Optional: Gets called with the latest cell editor params every time they update.
Optional: Returns the element to use for validation feedback.Parameters:
tooltip: Whether the element is for a tooltip or direct styling
Optional: The error messages associated with the Editor.
Complete Example
Built-in Cell Editors
AG Grid provides several built-in cell editors:'agTextCellEditor': Simple text input (default)'agLargeTextCellEditor': Multi-line text area'agSelectCellEditor': Dropdown select'agNumberCellEditor': Number input'agDateCellEditor': Date picker'agCheckboxCellEditor': Checkbox'agRichSelectCellEditor': Rich select with search (Enterprise)
Related APIs
Cell Renderer
Create custom cell renderers
Column Definitions
Configure cell editors in columns
GridApi
Programmatic editing control