New to KendoReact? Learn about KendoReact Free.
In-Cell Editing in KendoReact Data Grid
By utilizing the cellRender prop, you can assign a custom cell editor to each grid cell, allowing for a seamless and efficient cell editing experience.
To enable in-cell editing in the KendoReact Data Grid you have to:
-
Set the
editableprop of the Grid to true and configure itseditproperty to manage the built-in edit state and track which rows are being edited.jsxconst [edit, setEdit] = React.useState<EditDescriptor>({});jsx<Grid edit={edit} editable={{ mode: 'incell' }} > -
Handle the
handleItemChangeevent of the Grid in order to update the bound data based on the applied edits.jsxconst itemChange = (event: GridItemChangeEvent) => { if (event.field) { setData((data) => data.map((item) => item.ProductID === event.dataItem.ProductID ? { ...item, [event.field!]: event.value } : item ) ); } setChanges(true); }; -
Handle the
onEditChangeto update the edit state of the Grid.jsxconst handleEditChange = (event: GridEditChangeEvent) => { setEdit(event.edit); };
You can see a live implementation of this approach in the sample below, where state management and related functions update the Grid’s data and its built-in edit state.
Change Theme
Theme
Loading ...