Last Updated: 07 Jan 2020 10:10 by ADMIN
Created on: 07 Jan 2020 09:54
Category: Grid
Type: Bug Report
hasChanges() method clears flags for deleting records

.hasChanges() results in records flagged for Delete to not actually get deleted when .saveChanges() executes.

I found the same behaviour on a LiveDemo example that checks .hasChanges(): Grid - Binding to Telerik ClientDataSource

Steps to reproduce:

  • Make any change to the first record, such as modifying the Contact Name.
  • On the second record, Click the "x" under the DELETE column to mark it for delete.
  • Click any column heading to sort.  (This calls a UserAction event handler that calls .hasChanges())
  • Choose to Cancel at the popup prompt.
  • Click "Save changes".
  • Monitor the browser console, you will find that webservice UpdateCustomers is called,  but DeleteCustomers is not.


1 comment
Attila Antal
Posted on: 07 Jan 2020 10:08

Thank you for taking the time to report this problem. This is indeed an unexpected behavior of the Grid and we have recorded it in our system as a bug.



Instead of calling the built-in method "hasChanges()", try implementing a custom function to check for the changes like the example below:

function hasChanges(grid) {
    return grid.get_batchEditingManager()._extractChangesString(grid.get_masterTableView()).length > 0;


When the Grid would call the UserAction, use the custom method like this:

function UserAction(sender, args) {
    if (hasChanges(sender) && !confirm("Any changes will be cleared. Are you sure you want to perform this action?")) {