title: jqgrid colmodel editoptions to load json result
body: <p>I want to load my server data in the DropDown of my jqgrid. My code,</p>
  
  <p>UPDATED CODE:</p>
  
  <pre><code> public ActionResult GetUnit()
      {
          List&lt;UnitModel&gt; getUnitValues = new List&lt;UnitModel&gt;();
          //ToDo db code
          Dictionary&lt;int, string&gt; unitValues = new Dictionary&lt;int, string&gt;();
          unitValues = getUnitValues.ToDictionary(x =&gt; x.UnitID, x =&gt; x.UnitDesc);
          unitValues.Add(4, "Unit2/3");
          unitValues.Add(1, "Unit1");
          unitValues.Add(2, "Unit2");
          unitValues.Add(3, "Unit3");
          return Json(unitValues, JsonRequestBehavior.AllowGet);
      }
  </code></pre>
  
  <p>My jqgrid:</p>
  
  <pre><code>     colModel: [...
        {
              name: 'UnitID', index: 'UnitID', editable: true, edittype: 'select', width: "200",
              formatter: 'select', editoptions: { value: unitslist},
              editrules: { custom: true, custom_func: dupicateRecordValidation
              }
          },
  ...],
  
         beforeProcessing: function () {
                      $.ajax({
                      url: '/Home/GetUnit/',
                      dataType: 'json',
                      type: 'POST',
                      contentType: 'application/json; charset=utf-8',
                      success: function (data) {
                          $.map(data, function (value, key) {
                              unitsList += '"' + value + '"' + ':' + '"' + key + '"' + ',';
                          });
                          unitsList += '}';
                          alert(unitsList);
                      }
                  });
              },
  </code></pre>
  
  <p>But, this isn't working. The jqgrid DropDown column loaded with empty cell. Am I missing something? Is this the correct way to do? Please suggest if any alternate way to load the dropdown of jqgrid with server data with default value of that row being selected. Thanks.</p>
  
  <p>Note:I'm using Jquery jqgrid v4.4.4 Visual Studio</p>