We are using Mui-Datagrid component where the users can upload and edit their data.
Within customID
column definition, there are the preProcessEditCellProps
and renderEditCell
properties.
const columns = [ { field: "customID", headerName: "customID", width: 100, editable: true, preProcessEditCellProps: customIDValidation, renderEditCell: renderEditCell } ... ];
The preProcessEditCellProps
checking the validity of the input only when the user is typing.
If the length of the value is less than 3 then it returns error
& errorMessage
and then pass it to renderEditCell
as a props.
The thing is that we have a submit button where we want to validate the whole cells before submitting the data and then update the cell props in order to show which cells are invalid and style them as well.
I tried to figure out how to update these cell props using the apiRef of Mui DataGrid and i couldn't find any suitable method to achieve that.
attached codesandbox: https://codesandbox.io/s/morning-snow-pmj64y?file=/src/App.js
Any ideas are more than welcome Thanks!