kendo.data.DataSource.hasChanges() method true after save

1k views Asked by At

I've configured my kendo grid to call a custom service upon clicking "Save Changes" button. Function call is as follows:

saveChanges: function (e) {

    e.preventDefault();
    $scope.updateLineItems(e);

    // Clear red triangles on edited cells
    $scope.grid.refresh();
}

Does calling preventDefault() prevent the grid from resetting the return value of hasChanges()? When I make a change the value is true. I was hoping that after clicking "Save Changes" it would revert to false, but it does not. I tried adding a line after the grid refresh to manually run the cancelChanges() method, but that undid the changes in the grid display.

Is there any other method to take the grid out of edit mode?

Thanks in advance

1

There are 1 answers

0
Cara On

Does calling preventDefault() prevent the grid from resetting the return value of hasChanges()?

Calling the preventDefault() does not prevent from resetting the return value. The hasChanges() are determined by the dirty property. In your update operation, you should return a success call such as e.success() for the grid to know that changes have been applied.

You can also check their doc: http://docs.telerik.com/kendo-ui/framework/datasource/crud#update-local

Hope this helps!