title: How to post variable data with editData or onclickSubmit in jqgrid
body: <p>I can't get editData or onclickSubmit to do what I need.</p>
  
  <p>I want the grid to follow the added or edited row after update.  So, I need to post some additional info so the server can return the id and correct page of the added/edited record.</p>
  
  <p>I was able to do this using the addfunc and editfunc and a custom form, but I'd like to do it with the jqgrid generated forms.</p>
  
  <p>I have a global declared before the DocumentReady function.  Then, I tried using editData in the edit parameters and setting the variables in beforeSubmit or beforeInitData.  The variables are posted to the server, but only as they are initially declared.  It seems like the editData is created at initialization and can't be updated.  I also tried using onclickSubmit, but couldn't get that to work either.</p>
  
  <p>Here's an edited example:</p>
  
  <pre class="lang-js prettyprint-override"><code>var data2pass = {};
      data2pass['sortColumnName'] = '';
      data2pass['sortOrder'] = '';
      data2pass['rowNum'] = '';
  
  $(document).ready(function(){
  
    $("#ProdGrid").jqGrid({
      url:'products_DAT.php?thespot=server_ProdGrid',
      datatype: 'json',
      mtype: 'POST',
      colNames:['ID','Product Name:','Category:','Unit Price:'],
      colModel :[ 
        {name:'ProductID', editable:true},
        {name:'ProductName', editable:true},
        {name:'CategoryID', editable:true, edittype:"select", editoptions: { dataUrl:  "products_DAT.php?thespot=select4_CategoryID" }},
        {name:'UnitPrice', align:'right', editable:true, formatter:'currency'}
      ],
      pager: '#ProdGrid_pager',
      rowNum: 15,
      sortname: 'ProductName',
      sortorder: 'asc',
      gridview: true,
      editurl: 'products_DAT.php?thespot=update_ProdGrid',
      height: 'auto'
    });
  
  $("#ProdGrid").jqGrid('navGrid','#ProdGrid_pager', {},
  {closeAfterEdit:true, reloadAfterSubmit: false, editData: data2pass,
      beforeInitData: function(formid) { 
      data2pass['sortColumnName'] = 'ProductName';
      data2pass['sortOrder'] = 'asc';
      data2pass['rowNum'] = '15';
      }
  }, // Edit parameters
  {}, // Add Parameters
  {reloadAfterSubmit:true}, // Delete parameters
  {}, // Search params
  {} // View params
   );
  </code></pre>
  
  <p>However the data2pass variables are initially declared is what gets posted to the server. What event should I use to update the values of data2pass to post to the server? Or is there another better way to do it?</p>
  
  <p>Any advice is greatly appreciated.</p>
  
  <p>Thanks</p>