I'm a jqGrid newbie. I need to add a Delete button to the Edit form. I'm able to add the button, and it shows up as expected, including the confirmation dialog, but once pressed I'm not sure how to refer to the original row id:
// Add a Delete button in Edit form:
$.extend($.jgrid.edit, {
bSubmit: "Submit",
bCancel: "Cancel",
width: 370,
recreateForm: true,
beforeShowForm: function () {
$('<a href="#">Delete<span class="ui-icon ui-icon-circle-close"></span></a>')
.click(function() {
if(confirm("Are you sure you want to delete this record?")) {
$("#projectList").jqGrid('delGridRow', row_id);
}
}).addClass("fm-button ui-state-default ui-corner-all fm-button-icon-left")
.prependTo("#Act_Buttons>td.EditButton");
}
});
row_id in the code above is not defined .. How can I refer to the id of the currently selected row from this place in the code? The function above is currently parallel to the other main jqGrid functions, such as $("#projectList").jqGrid({ .. }). Or better, how can I hook into the default jqGrid delete function from here? Thank you!