You cannot change the parameters of editing events so easily because the parameters are stored in the internal variable of the navGrid function. Therefore, you must unbind the click event with the "Edit" button and bind a new event that calls the editGridRow method with all the new parameters that you need. New options may include an event handler, such as beforeShowForm .
The corresponding code could be something like this:
var grid=$("#list"); // your jqGrid (the <table> element) var grid_id = grid[0].id; // id of the <table> element like "list" $("#edit_"+grid_id).unbind('click'); // unbind original 'click' handle $("#edit_"+grid_id).click(function() { if (!$(this).hasClass('ui-state-disabled')) { var sr = grid[0].p.selrow; // get id of selected row if (sr) { grid.jqGrid("editGridRow",sr, { // here you should place all Edit parameters beforeShowForm: function(formid) { alert("In beforeShowForm()"); } }); } else { // display error message $.jgrid.viewModal("#alertmod",{gbox:"#gbox_"+grid_id,jqm:true}); $("#jqg_alrt").focus(); } } return false; });
UPDATED . If you call the editGridRow method directly somewhere and cannot change the code you can do as follows
var grid=$("#list"); // your jqGrid (the <table> element) var orgEditGridRow = grid.jqGrid.editGridRow; // save original function $.jgrid.extend ({editGridRow : function(rowid, p){ $.extend(p, { // modify some parameters of editGridRow beforeShowForm: function(formid) { alert("In new beforeShowForm()"); } }); orgEditGridRow.call (this,rowid, p); }});
source share