如何在使用具有 ODATA 类型的 KendoUI Grid 更新数据之前要求确认?

Ale*_*ano 5 confirmation odata kendo-ui kendo-grid kendo-datasource

当我单击剑道网格编辑弹出表单的更新按钮时,我需要要求确认(确认对话框)。问题是使用 ODATA,我指定kendoGridConfiguration.dataSource.transport.options.update.url,并且我不能引入任何异步逻辑作为确认消息。你能帮助我吗?

如果我想使用 odata 确认从网格中删除元素,也会发生同样的情况。

谢谢!

Rah*_*pta 3

我在这里创建了一个演示,其中在更新记录之前会要求用户确认,并且只有在用户同意的情况下才会编辑记录。

我已经绑定了save网格的事件并添加了代码以在编辑操作继续之前要求确认。

这是 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();
                                    }
                                }
                          }
.......
.....
Run Code Online (Sandbox Code Playgroud)