react-data-grid
react-data-grid copied to clipboard
How to add cell validations like we do in forms.
How can I add validations for cells,
- Such that it any user enter wrong input, it should show error msg.
- Is there any variable which tell all the entered information in react data grid is valid, like
isValid
I use to provide technical fields on my Row:
type Row = RowData & { errors?: ExtractFromRowData<RowData> };
/* Should ends like
* type Row = { field: string; errors?: { field?: YourOwnErrorType } }
*/
renderCell: (row: { field, errors }) =>
<SomeWrapperShowingErrorInAWay error={errors?.field}>
<HowYouDisplayYourCell>{field}</HowYouDisplayYourCell>
</SomeWrapperShowingErrorInAWay>
When I generate Rows or onRowChange, you should generate errors from the RowData.
@splacentino can you pls elaborate this more. I am kind of confused here
Closing as this is beyond of the scope of RDG editing.