I need to send an extra parameter while I am trying to delete one or more rows in jQgrid. I have found the following:
But those are one/two year old answers and I think jQgrid has changed since then. I am using the formDeleting
option from jQgrid defined as follow:
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");
}
}
}
How do I add an extra parameter to the request so I can get it on the backend?
I'd recommend you to use onclickSubmit callback close to the answer, but to place the code of the onclickSubmit
callback inside of formDeleting
. The usage of serializeDelData inside of formDeleting
inside of formDeleting
is possible too, but it's better to use it in case of more deep changing in the posted data, like the usage of JSON.stringify
, for example.