Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can not so easy to change parameters of edit events because the parameters are saved in internal variable of <code>navGrid</code> function. So you should unbind the click event to the "Edit" button and bind the new one event which call <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki%3aform_editing#editgridrow" rel="nofollow">editGridRow</a> method with all new parameters which you need. The new parameters can include event handler like <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki%3aform_editing#events" rel="nofollow">beforeShowForm</a>.</p> <p>The corresponding code can be about the following:</p> <pre><code>var grid=$("#list"); // your jqGrid (the &lt;table&gt; element) var grid_id = grid[0].id; // id of the &lt;table&gt; 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; }); </code></pre> <p><strong>UPDATED</strong>: If you call somewhere <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki%3aform_editing#editgridrow" rel="nofollow">editGridRow</a> method directly and can not change the code you can make following</p> <pre><code>var grid=$("#list"); // your jqGrid (the &lt;table&gt; 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); }}); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload