title: Populate select in jqgrid filter toolbar
body: <p>I've tried to populate a dropdownlist with values from my database. I've got the following code in my .js file:</p>
  
  <pre><code>function getDropdowndata() {
  var sHTML;
  var filter;
  var url = "dropdown.json";
  jQuery.getJSON(url, function (dddata) {
      if (dddata.rows.length &gt; 0) {
          sHTML = "";
          for (x = 0; x &lt; dddata.rows.length; x++) {
              sHTML += (dddata.rows[x].Type + ":" + dddata.rows[x].Type + ";");
          }
          filter = sHTML.substring(0, sHTML.length - 1);
      }
  });
  return filter;
  }
  </code></pre>
  
  <p>And in my Jqgrid list I've got the following:</p>
  
  <pre><code>editoptions: { value: ":All;" + getDropdowndata() }
  </code></pre>
  
  <p>The problem I've got with this code is that it seems that the function is being executed too early and because of that the dropdownlist contains nothing.</p>
  
  <p>The reason for my assumption is that if I put an alert inside of the javascript function before the return, the dropdownlist is filled with the values and everything seems to work.</p>
  
  <p>Any suggestions?</p>