This is a migrated thread and some comments may be shown as answers.

How to enforce validation in grid sample?

1 Answer 26 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jack
Top achievements
Rank 1
Jack asked on 13 Aug 2015, 02:59 PM

Use the example at http://demos.telerik.com/kendo-ui/grid/editing-custom.

To reproduce the issue:

  1. Click Add new record once
  2. Click Add new record a second time: a validation message is displayed
  3. Click Delete on any other record: validation is no more enforced and you get a bad record
  4. Click Add new record ‚Äča third time, a new record is added although a previous record is invalid

How to properly enforce validation is this example?

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 17 Aug 2015, 11:18 AM

Hello Jack,

I would like to clarify that in this case Delete operation is separate from the UI validation and will be performed regardless of whether validation passed or not. Since the data item is already added to the DataSource (not synced with the server, the item exists only on the client side) it will be rendered in the Grid. This is how the Kendo UI Grid and DataSource works internally. 

 

There is a specific about the referred example because the InCell edit mode of the Kendo UI Grid is set. In this mode only one field of the model could be opened for editing at a time (only this field will be validated). For example if only UnitsPrice field is marked as required adding  new items will not throw a validation error (since by default only the first field will be opened for edit and eventually validated). 

 

Using the InLine edit mode such behavior will not be observed. The item will not be added to the DataSource. 

 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Jack
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or