Value of dyanamic select in jqGrid not being submitted
<p>I'm trying to create a grid with a column of type select, having dynamic options. The options are populated after the Edit Form is displayed.</p>

<p>My idea was to use the <code>dataInit</code> event as described in <a href="https://stackoverflow.com/questions/1291290/jqgrid-dynamic-select-option">this</a> answer.</p>

<p>The model for the column is:</p>

<pre><code> {name: 'bad', index: 'bad', editable: true, edittype: 'select',
  editoptions: {
    dataInit: function(elem) {
      setTimeout(function() {
        $(elem).empty()
          .append("&lt;option value='1'&gt;Option 1&lt;/option&gt;")
          .append("&lt;option value='2'&gt;Option 2&lt;/option&gt;");

      }, 50);
    }
  }
</code></pre>

<p>The options are correctly populated in the form, but when submitting, the value of the select field is not sent to the controller. I have used the <code>beforeSubmit</code> event to display the <code>data</code> object being sent:</p>

<pre><code>beforeSubmit: function(data, id) {
   alert(JSON.stringify(data));
   // Alerts:     {"":"1","list_id":"_empty"}
   // Notice that "" should be "bad"
}
</code></pre>

<p>Test it yourself: <a href="http://fiddle.jshell.net/6zaHp/137/" rel="nofollow noreferrer">http://fiddle.jshell.net/6zaHp/137/</a></p>