title: jqGrid reload datatype: local for each request
body: <p>I am using jqGrid but due to my server side technology I cannot call a URL directly to get the data and can only post to the server via a 3rd party broker. My goal is to be able to load data into the Grid via calling my own JavaScript function that calls the server and returns a JSON string.</p>
  
  <p>What I tried: instead of</p>
  
  <pre><code>url:'http://127.0.0.1/products/index.php’,
  datatype: 'json',
  </code></pre>
  
  <p>I have</p>
  
  <pre><code>datastring:init(),
  datatype: 'jsonstring',
  </code></pre>
  
  <p>my <code>init()</code> function does the server-side call. It works fine for the initial page load. However it is never called again e.g. when I jump between pages, or change the number of rows to view. I need it to recall my init function to refresh the data from the database. However it does not ever call my <code>init()</code> function more than once. I assume it thinks this is a hard coded string which never changes.</p>
  
  <p>I tried to call <code>$("#mygrid").trigger("reloadGrid");</code> manually but it doesn’t seem to work either.</p>
  
  <p>My Grid is:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(function(){
    $("#list").jqGrid({
      datastr:init(),
      datatype: 'jsonstring',
      mtype: 'GET',
      beforeRequest: beforeReq,
      pager: '#pager',
      rowNum:5,
      rowList:[5,10,30],
      sortname: 'invid',
      sortorder: 'desc',
      grouping:true,
      viewrecords: true,
      gridview: true,
  
    });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>I tried calling</p>
  
  <pre><code>$("#list").setGridParam({datatype:'jsonstring', page:1}).trigger('reloadGrid');
  </code></pre>
  
  <p>I tried what Oleg has suggested <a href="https://stackoverflow.com/questions/5397671/jqgrid-reloadgrid-with-loadonce-set-to-true/5398136#5398136">here</a> and <a href="https://stackoverflow.com/questions/15461597/jqgrid-reload-data-from-json-string">here</a>  but it still does not seem to call my init function again.</p>