Grid Column validations

1 Answer 64 Views
Grid
Rebeca
Top achievements
Rank 1
Iron
Rebeca asked on 17 May 2022, 11:34 AM

Hi!
I have been using validation properties (required, max length, validationMessage etc) for the forms.

Is there any way to have the same functionality for Grid component to have validations in the  Columns?

As they are free inputs for the users too, 
would be nice if you can provide some examples to know how to handle them.

Thanks for your time,
Rebeca.

1 Answer, 1 is accepted

Sort by
0
Filip
Telerik team
answered on 19 May 2022, 09:24 AM

Hello, Rebeca,

The validation in the Grid is done using custom cells.

There are a couple of options for this:

- Render a custom cell where the editor for the cell will have its own validation attributes like required, min, max, etc:

https://stackblitz.com/edit/react-x5wmrp-2fkqz9?file=app/main.jsx

- Another option is to validate the input value dynamically on the item change event and mark the value as invalid and then add styles to the cell to indicate that

https://stackblitz.com/edit/react-iswgtn?file=app/main.js

https://stackblitz.com/edit/react-54kpht?file=app%2Frenderers.jsx

I hope this helps.

Regards, FilipProgress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
Rebeca
Top achievements
Rank 1
Iron
Answers by
Filip
Telerik team
Share this question
or