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

Cancel edit doesnt really cancel

1 Answer 21 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anna
Top achievements
Rank 1
Anna asked on 12 Jun 2015, 07:09 PM

Working with a grid that I've made, that has a popup edit. We have a custom method for edit, add and cancel that does a little extra logic (nothing fancy). We've been finding that if you edit a record, change some of the data, but then click cancel, the data in the grid remains editted. I was able to reproduce it on one of the demo's from the API documentation.

 Here's the link:

 http://dojo.telerik.com/iQEte

Literally the only thing I changed from the original API documentation example was I added e.sender.refresh() before the e.preventDefault().

 If you change Jane Doe to John Doe then click cancel, the grid will now say John Doe, even though you clicked cancel.

 Whats going on?

1 Answer, 1 is accepted

Sort by
0
Anna
Top achievements
Rank 1
answered on 15 Jun 2015, 04:22 PM

For anyone that ends up here, I finally figured out what was going on.It seems silly that I should have to specify the cancel event when all I want to do is use the default cancel functionality. So I removed the method, which then would end up deleting the row altogether. This brought me to this post:

Kendo grid cancel causing deletion of row

After deleting the "custom" cancel method on my grid options, I added the following line of code in my datasource:

model: { id: "Key" . . . }

Works like a charm now. Apparently it needs a specified id field in the datasource in order to cancel properly.

Tags
Grid
Asked by
Anna
Top achievements
Rank 1
Answers by
Anna
Top achievements
Rank 1
Share this question
or