Kendo grid cancelChanges problem

advertisements

I am working on a web application using kendo grid(Angular JS). I should call grid.saveChanges() after every delete or insert operation. But in a special scenario such as

  1. Insert a record and call saveChanges
  2. Then delete the same record and call saveChanges
  3. Then call the call grid.cancelChanges()

Normally it goes back to last saveChanges state but in my case it is showing the deleted row. Any help?


I've tried what you say in this demo: http://demos.telerik.com/kendo-ui/grid/editing but it works correctly.

Maybe it only works when you call saveChanges() manually. Data to restore when you're calling cancelChanges() is stored in _pristineData property so try this workaround:

var grid= $("#YourGrid").data("kendoGrid");
grid.saveChanges();
grid.dataSource._pristineData = grid.dataSource._data;