Kendo grid row validation

1 Answer 4551 Views
Grid
shaneed
Top achievements
Rank 1
shaneed asked on 09 Apr 2014, 07:20 AM
We have a grid with editing mode set to inline edit. The grid autoSync is set to false. User make changes to grid, and on clicking a save button (which is outside the grid), edited grid rows are saved to server. Grid row has a textbox, dropdown box and combobox as input field. Each row also have validation status icon in the last column. If user has not entered any value in textbox, or not selected any value in dropdown box or combobox , validation icon for that row is shown. On hover over the validation icon, corresponding errors for that row are shown to user. If user has selected all valid value, validation icon is not shown, indicating everything is correct.

We are currently doing validation on complete grid and refresh grid to show the icon for row with error. This validation is done every time user insert/update input field value. Can you suggest us the best way to do this? Is there a way, like on changing the row input field value, only row should be refreshed and validation icon should show/not show based on validation status.

1 Answer, 1 is accepted

Sort by
-1
Petur Subev
Telerik team
answered on 11 Apr 2014, 06:58 AM
Hello Shaneed,

Basically to create validation for a field you have to specify it for a field inside the dataSource model. 

http://docs.telerik.com/kendo-ui/api/framework/datasource#configuration-schema.model

The same approach is used in the following demo:

http://demos.telerik.com/kendo-ui/web/grid/editing-custom-validation.html

In case you want to validate the items on the server side, you should return error from the server in the specified field from the response:

http://docs.telerik.com/kendo-ui/api/framework/datasource#configuration-schema.errors

Thus the error event on the dataSource will be triggered and you will have to prevent the next dataBinding event of the Grid and display the errors manually.

Same approach is used on the following code library:

http://www.telerik.com/support/code-library/handling-server-side-validation-errors-during-pop-up-editing

Kind Regards,
Petur Subev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Lee
Top achievements
Rank 2
Bronze
Bronze
Bronze
commented on 01 Dec 2022, 10:14 PM

The question specifically asks for a grid where the fields are updated by clicking a submit button outside of the grid. The examples provided are for within the grid. 
Nikolay
Telerik team
commented on 05 Dec 2022, 10:49 AM

Hi Lee,

I recommend checking out the following forum post that answers this question.

Please note this targets Kendo UI for ASP.NET for MVC, however, the implementation is entirely valid for Kendo UI for jQuery.

Regards,

Nikolay

Tags
Grid
Asked by
shaneed
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or