title: JQGrid - Select list value not set in edit mode using IE
body: <p>I am creating a web page using MVC, with a JQGrid showing some data. The grid uses inline editing, and one of the columns becomes a select input during edit mode. When I begin editing, the select input does not seem to take the value of the cell, instead the initial selected item is the first in the list. This happens in IE, but when using Firefox, the selected item correctly takes the value of the cell.</p>
  
  <p>I define my column as follows:-</p>
  
  <pre><code>{ name: 'MyColumn', index: 'MyColumn', width: 80, align: 'left', editable: true,sortable: true,hidden: false,Key: false, edittype: 'select', editoptions: { value: "0:None;1:Option1;2:Option2;3:Option3", width: 'auto',size: 20, maxlength: 30}}
  </code></pre>
  
  <p>I populate my grid using a json helper class to convert a DataTable into a string. The databind function in my controller class looks like this:-</p>
  
  <pre><code>DataTable results = GetResults(sidx, sord, startIndex, endIndex, out resultsCount);
          return Content(JsonHelper.JsonForJqgrid(results, rows, resultsCount, page), "application/json");
  </code></pre>
  
  <p>I used firebug to test the the html that is produced, and both IE and FF give the following after edit mode is triggered.</p>
  
  <pre><code>&lt;td aria-describedby="MyGrid_MyColumn" title="Option3" style="text-align: left; color: red;" role="gridcell"&gt;
     &lt;select role="select" width="auto" formatter="select" size="1" maxlength="30" id="3_MyColumn" name="MyColumn" class="editable"&gt;
        &lt;option role="option" value="0"&gt;None&lt;/option&gt;
        &lt;option role="option" value="1"&gt;Option1&lt;/option&gt;
        &lt;option role="option" value="2"&gt;Option2&lt;/option&gt;
        &lt;option role="option" value="3"&gt;Option3&lt;/option&gt;
      &lt;/select&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p>My datatable currently gets the value of the column as the 'text' value, so FF is matching the value of the cell, to the 'text' value of the select input. I have the capacity to get the value as the actual value used in the select input, but this meant the cell showed the value instead of the text when not in edit mode (and still didn't match on edit mode in IE).</p>
  
  <p>To clarify, the problem is if the cell has a value of'Option3', in IE when entering edit mode the select input will show 'None' as it's selected item instead of 'Option3'. Firefox will correctly show 'Option3' as the selected item.</p>
  
  <p>Any tips?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Found a solution, I wouldn't call it the answer. I updated my selectRow function, and collected the cell value before entering edit mode, then updated the dropdown afterwards with the selected option. Feels like a bit of a hack, but it works.</p>
  
  <pre><code>onSelectRow: function(id){
      if (id){
          if (id != lastSel){
              jQuery('#MyGrid').restoreRow(lastSel);
              var rowdata = jQuery('#ShippingListGrid').getRowData(id);
              jQuery('#MyGrid').editRow(id, true, true, true, '/EditURL/', null, true, true);
              $("#" + id + "_MyColumn").val($("#" + id + "_MyColumn option:contains('" + rowdata.MyColumn + "')").val());
              lastSel = id;
           } 
           else { 
              lastSel = '';
           }
      }
  }
  </code></pre>