Provided Cell Editors
AG Grid Provided Cell Editors
AG Grid provides the following cell editors:
- Text editor
- Large text editor
- Date editor
- Select editor
- Rich select editor (enterprise only)
- The text cell editor is the default.
- Use the
cellEditor
column definition property to specify a provided or custom cell editor.
We can specify the provided large text cell editor.
export default function Grid() {
const [columnDefs] = useState<ColDef<RowData>[]>([
{
headerName: 'Account No',
field: 'account.accountNumber',
editable: true,
cellEditor: 'agLargeTextCellEditor',
},
]);
}
We can specify the provided select cell editor editor.
export default function Grid() {
const [columnDefs] = useState<ColDef<RowData>[]>([
{
headerName: 'Account No',
field: 'account.accountNumber',
editable: true,
cellEditor: 'agSelectCellEditor',
},
]);
}
Exercise
- Open the exercise on Stackblitz.
- Enable cell editing for the Customer Name column.
- Enable cell editing for the Account No column and use the
agLargeTextCellEditor
.
Solution
export default function Grid() {
const [columnDefs] = useState<ColDef<RowData>[]>([
{
headerName: 'Customer Name',
field: 'customer.name',
editable: true,
},
{
headerName: 'Account No',
field: 'account.accountNumber',
editable: true,
cellEditor: 'agLargeTextCellEditor',
cellEditorPopup: true,
},
]);
}