5

I need to ask for a confirmation (a confirm dialog), when i click the update button of the kendo grid edit popup form. The problem is that using ODATA, i specify the kendoGridConfiguration.dataSource.transport.options.update.url, and i cant introduce any async logic as a confirmation message. Can you help me?

The same would happen if I wanted to confirm a deletion of an element from the grid using odata.

Thanks!

Rahul Gupta
  • 9,775
  • 7
  • 56
  • 69
  • 1
    I don't use ODATA personally, but to accomplish what I think you are trying to do I simply just added an if statement to jquery that is just `if (confirm('Are you sure you want to delete this record?')) { YOUR_FUNCTION_FOR_DELETE_HERE }`, that is what I am currently using to confirm a user wants to delete something before sending the delete to the db – stephen Oct 13 '17 at 23:12

1 Answers1

3

I have created a DEMO here in which the user would be asked for confirmation before updating the record and the record will only be get edited if the user would agree.

I have bound the save event of the grid and added code to ask for confirmation before the edit action proceeds.

Here is the code from the DEMO.

.....
.......
//On click of POPUP form Update button
                          save: function(e) {
                                //check if the row is being edited and not newly added
                                if (! e.model.isNew())
                                {
                                    if (! confirm("Are you really sure that you want to update the data ?")) 
                                    {
                                        //In the confirm box, if the user clicks no or cancel, then do not proceed with the updation of record
                                        e.preventDefault();
                                    }
                                }
                          }
.......
.....
Rahul Gupta
  • 9,775
  • 7
  • 56
  • 69