Unplanned
Last Updated: 09 Aug 2024 09:12 by ADMIN
CDK
Created on: 07 Jan 2020 09:54
Category: Grid
Type: Bug Report
2
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.

 

3 comments
ADMIN
Attila Antal
Posted on: 09 Aug 2024 09:12

Hello Ken,

Yes, we will fix this issue when the time arrives. Currently we are dedicated to improving the performance and security of the Telerik Controls which comes with the highest priority.

Until the issue is resolved, please use the provided workaround. 

Thank you for your understanding.

Regards,
Attila Antal
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources
Ken
Posted on: 08 Aug 2024 12:59
Will this ever be fixed ?
ADMIN
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.

 

Workaround:

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?")) {
        args.set_cancel(true);
    }
}