We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Confirm Delete

Hi I am trying to add a confirm delete box 

If i add a confirm dialog to the ActionComplete event

 if (confirm("Are you sure ? ")) { 
                        PageMethods.DeleteIt(ganttRec, onSucceeded, onFailed);
                        if (data.hasChildRecords) {
                            deleteChildRecords(data);
                        }
          }

The Confirm Dialog is popping up and if I select cancel the delete is not synced to DataBase, but unfortunatly the GUI itself is updated and the Task is deleted in the view.
After reloading the page by getting the data out of the DB its fine.

How can I avoid that the view will be updated with the deleted record?

Or is there maybe a build in delete confirm Dialog?


Thanks for help
Martin




3 Replies

SR Suriyaprasanth Ravikumar Syncfusion Team August 7, 2017 12:33 PM UTC

Hi Martin, 
 
Please find the response below.  
 
The “ActionComplete” client side event for delete action was triggered only after the successful completion of delete operation. 
Hence the confirmation dialog was not working properly. We can achieve your requirement by using “ActionBegin” client side event. 
Please refer the following code snippet,  
[ASPX] 
<ej:Gantt ID="GanttControlResource" ActionBegin="ActionBegin" ActionComplete="ActionComplete"> 
</ej:Gantt> 
<script type="text/javascript"> 
            function ActionBegin(args) { 
                    if (args.requestType === 'delete' && !confirm("Are you sure ? ")) 
                        args.cancel = true; 
            } 
            // To update the database through dialog editing or tool bar editing 
            function ActionComplete(args) { 
                // Sql delete operations 
            } 
        </script> 
 
We have also prepared a sample for your reference, please find the sample location as below, 
Thanks, 
Suriyaprasanth R. 



MS Martin Sickel August 8, 2017 07:36 AM UTC

Thank you for the great Support.

Martin



JD Jayakumar Duraisamy Syncfusion Team August 9, 2017 04:18 AM UTC

Hi Martin, 
Thanks for the update. 
Regards, 
Jayakumar D 


Loader.
Up arrow icon