【问题标题】:Replacing default jqgrid dialog with sweetAlert用 sweetAlert 替换默认的 jqgrid 对话框
【发布时间】:2021-03-07 16:41:35
【问题描述】:

我正在尝试用 sweetalert jquery 替换 jqgrid 默认删除对话框弹出窗口。当我使用下面的代码删除按钮时,它工作正常,但它仍然显示默认的 jqgrid 删除确认方法。

知道如何正确调用 sweetalert 确认对话框吗? 谢谢

    url: editUrl,
    closeOnEscape: true,
    closeAfterDelete: true,
    recreateForm: true,   
    beforeShowForm: function ($form) {
    swal({
                                title: "Are you sure?",
                                text: "You will not be able to recover this imaginary file!",
                                type: "warning",
                                showCancelButton: true,
                                confirmButtonColor: "#DD6B55",
                                confirmButtonText: "Yes, delete it!",
                                closeOnConfirm: false
                            }, function () {
swal("Deleted!", "Your imaginary file has been deleted.", "success");
                            });
                    },

【问题讨论】:

    标签: dialog jqgrid sweetalert


    【解决方案1】:

    你不能这样做。您使用的方法是从 stackoverflow 演示中获取的,它替换了现有对话框中的文本。它不会将对话框替换为自身。

    要执行您想要的操作,我建议您创建一个自定义导航器按钮并定义您自己的 ajax 函数以使用您的对话框再次删除该行。不要忘记在这种情况下使用 delRowData 在本地删除行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-06
      相关资源
      最近更新 更多