Reputation: 1542
I'm using MUI 5 data-grid (basic, not pro, etc.) and I need a custom renderEditCell function, which I know how to use, but the cell content can be either a plain string or an object. If its an object I want to use a custom editor but if its a plain string I want the user to be able to edit in-place as a normal cell.
So how can I return a value from my renderEditCell function that invokes the default behavour? Can I import the default function and return it?
Upvotes: 2
Views: 1832
Reputation: 46
You can use the GridEditInputCell
component to fall back to the default.
renderEditCell: (params) => {
if (customCondition) {
return (
<CustomEditComponent />
);
}
return <GridEditInputCell {...params} />;
},
Upvotes: 3