简体   繁体   English

Kendo UI Grid使用JavaScript确认对话框取消SaveChanges

[英]Kendo UI Grid Cancel SaveChanges using a javascript confirm dialog

Is there a way to cancel a SaveChanges event from the client side before to proceed with changes? 有没有办法在进行更改之前从客户端取消SaveChanges事件? I'm using a simple javascript native confirm dialog : 我正在使用一个简单的JavaScript本机confirm对话框:

kendo grid: 剑道网格:

@(Html.Kendo().Grid<StrategyParameterModel>()
    .Name("strategyParameters")
    .Events(e => e.SaveChanges("onSave"))
    .Columns(columns =>
    { ... }

javascript: javascript:

 function onSave() {
     return confirm("Are you sure?");
 };

I am of mind that the cancelation of the event would work since the event is raised prior to posting, however, I have not tried it and I am currently not able to test it. 我谨记,由于在发布之前引发了该事件,因此取消该事件将起作用,但是,我尚未尝试过,并且目前无法测试。 If it does it work then leave a comment and I will delete the answer. 如果可以,请发表评论,我将删除答案。

 function onSave() {
     if(!confirm("Are you sure?"))
         e.preventDefault();
 };

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM