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

Remove new record in grid when required field is empty

1 Answer 499 Views
Grid
This is a migrated thread and some comments may be shown as answers.
rafi
Top achievements
Rank 1
rafi asked on 28 May 2014, 04:17 PM

Hello, 

I use kendo grid on batch editing mode, and I have a problem with the required validator.

The problem is that when user adds a new row without filling the required cell, he
can't select a different cell, as expected, but, he does can press on one of
the paging navigation button or on delete button in different row.

In case of pressing on page navigation button, the next grid page will be displayed,
and the new row that the user created will stay exists, although the required
field is not filled.

If I use the grid in inline editing mode, In case of pressing on "edit"
button of different row, while the focus is stuck in the new, not filled, row-
the new row will be removed.

My question is, how can I copy the second scenario behavior to the first, namely, how can I remove new
row that is not valid when the user navigates to another page?

 
For reproducing the scenarios described above, you can open this demo:
http://demos.telerik.com/kendo-ui/grid/editing-inline
and do as follow:

First scenario:

    1.  Press on "add new record" button.

    2.  Press on the page navigation button for viewing another page.

    3.  Return to the first page.

    4.  The first row exists with an empty value in the first cell (although this field is required)!

Second scenario:

    1.  Press on "add new record" button.

    2.  Press on "edit" button in the next row.

    3.  The new row is disappeared.



Thank you very much!



    











1 Answer, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 31 May 2014, 07:49 AM
Hello,

I prepared a simple demo, which shows how to prevent grid paging when an edit form is opened. You will need to wire edit and save events of the grid and prevent the datasource's requestStart if edit form is still opened.
With regards to second question, the grid is designed to allow deletion even when the edit form is opened. You can use the remove event to prevent the deletion, but the confirmation window will be opened. The confirmation window can be controlled from this option, but only on initial initialization.
Refer to the same demo for more information about the mentioned approach.

Regards,
Georgi Krustev
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
rafi
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or