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

Validation bug for a Sortable Grid with a Create button and Inline edit mode

2 Answers 66 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Don
Top achievements
Rank 1
Don asked on 04 Jun 2015, 09:44 PM

I have a grid that is Sortable and has a toolbar with a Create button. The grid's editable mode is set to "inline".

When a user clicks the "Add new row" button a new row is added and is in edit mode.

If, before adding data, the user clicks on a column header the row is added to the grid even though the required fields are empty.

Here is a demo... http://dojo.telerik.com/aQIkE/2

 

How can I get the validation to fire and cancel the column click?

 

Thanks,
Don Shrout
<><

2 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 08 Jun 2015, 02:13 PM

Hello Don,

The validation that prevents item with empty fields to be added is actually UI validation. In other words it works only if this item is on the current page. 

In case of sorting the newly item is added to the data source and then the data source is sorted again. This is required in order to position this newly created item to the right index in the data source (since the data is sorted). The problem is that the item is not added to the current page, so the UI validation will not work and it is added with empty fields. 

A possible solution would be after the item is added to the data source to page the Grid to the page, which contains the newly created item and force its row to switch to edit mode. The editRow method will do that. 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Don
Top achievements
Rank 1
answered on 08 Jun 2015, 02:59 PM

Thank you for the response. I thought it might turn out to be something like that.

What I did to solve my problem is I put code in the edit event of the grid to overlay transparent divs on top of the grid header and pager. I then put code in the save and cancel events to remove the overlays when the row exits edit mode.

This prevents the user from sorting or paging while a row is in edit mode.

 

Thanks,
Don Shrout
<><

Tags
Grid
Asked by
Don
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Don
Top achievements
Rank 1
Share this question
or