title: JQgrid: During modal initialization, how would I determine what model is being created (add/edit)
body: <p>I've got a case when i need to provide a different source id based on if the user is editing or adding. My initial idea was to set a hidden field's value using the beforeShowForm hook, but it seems that the components get initialized before the hook's function is called. Thus I'm unable to determine what model is being created at that stage of initialization.</p>
  
  <p><strong>[A]</strong></p>
  
  <pre><code>//initLoadNoEdit gets called... (At this point I need to know if its going to be an add/edit.)
  initLoadNoEdit = function (elem) {
      if ($('#curr_action').val() == 'add') {
          createLoadNumberWidget(elem, "#Date", 'some_url');
      } else {
          createLoadNumberWidget(elem, "#modal_date", 'some_url');
      }
  }
  
  var colModel = [
          { name: 'FI_ID', index: 'FI_ID', key: true, editable: false, hidden: true, search: false },     
          { name: 'LILBP_ID', index: 'LILBP_ID', editrules: { required: true }, editoptions: { dataInit: initLoadNoEdit } }
  ];
  
  //...before this gets called
  var addBeforeShowOptions = function (form) {
      $('#curr_action').val('add');
  }
  
  //...or this
  var editBeforeShowOptions = function (form) {
      $('#curr_action').val('edit');
  }
  </code></pre>
  
  <p>I then tried to add an on click event on the button add/edit click of the grid, i tried .live(), .delegate(), and just a normal .click(). but had no results, the pager renders as follows..</p>
  
  <p><strong>[B]</strong></p>
  
  <pre><code>   &lt;td id="pager_left" align="left"&gt;
        &lt;table cellspacing="0" cellpadding="0" border="0" class="ui-pg-table navtable" style="float:left;table-layout:auto;"&gt;
         &lt;tbody&gt;
          &lt;tr&gt;
            &lt;td class="ui-pg-button ui-corner-all" title="Add new row" id="add_theGrid"&gt;
                &lt;div class="ui-pg-div"&gt;
                   &lt;span class="ui-icon ui-icon-plus"&gt;&lt;/span&gt;
                &lt;/div&gt;
            &lt;/td&gt;
          &lt;/tr&gt;
         &lt;/tbody&gt;
        &lt;/table&gt;
      &lt;/td&gt;
  </code></pre>
  
  <p>so i tried something like</p>
  
  <pre><code> $('#add_theGrid').live('click', function () { $('#curr_action').val('add'); }); 
  
   //and
  
   $('#pager_left').delegate('#add_theGrid','click', function () { $('#curr_action').val('add'); });
  </code></pre>
  
  <p>that being said... i don't think that passing a value into a variable is the best way to go about this, as I'm sure there should be a way of me to determine from the modal, what type of modal it is? I just haven't been able to find it yet..</p>