繁体   English   中英

在jQgrid中使用“ formDeleting”时,如何添加要发送到服务器的额外参数?

[英]How to add an extra parameter to be sent to the server while using “formDeleting” in jQgrid?

当我尝试删除jQgrid中的一个或多个行时,我需要发送一个额外的参数。 我发现以下内容:

但这是一两年的答案,我认为jQgrid从那时起发生了变化。 我正在使用formDeleting选项,定义如下:

formDeleting: {
    url: '/ajax/forms/delete',
    delicon: [true, "left", "fa-scissors"],
    cancelicon: [true, "left", "fa-times"],
    width: 320,
    caption: 'Delete form',
    msg: 'Are you sure you want to delete this form?',
    beforeShowForm: function ($form) {
        var rowids = $form.find("#DelData>td").data("rowids");

        if (rowids.length > 1) {
            $form.find("td.delmsg").html('Are you sure you want to delete all the selected forms?');
        }
    },
    afterComplete: function (response, postdata, formid) {
        if (response.responseText === "true") {
            alert("The form was deleted successfully.", "Information");
        } else {
            alert("Something went wrong, the form could not be deleted.", "Error");
        }
    }
}

如何在请求中添加额外的参数,以便可以在后端获取它?

我建议你使用onclickSubmit回调接近的答案 ,但对的代码放置onclickSubmit回调的内部formDeleting 也可以在formDeleting内部的formDeleting内部使用serializeDelData ,但最好在发布的数据发生更深的更改的情况下使用它,例如JSON.stringify的用法。

暂无
暂无

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

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