title: jqgrid setGridParam datatype:local
body: <p>I don't want to hit the server and bring back every row when I am paging through the records by using the pager.  I read that if I set the datatype = local in the complete blog in the .ajax function AND if I set loadonce:true then I should be able to avoid having to wait for the grid to reload with the data.</p>
  
  <p>However, when I do these things the grid doesn't go to the next page.  It just hangs...<br>
  What am I doing wrong?</p>
  
  <pre><code>jQuery(document).ready(function () {
      jQuery("#list").jqGrid({
          datatype: processrequest,
          mtype: 'POST',  
          jsonReader: {  
              root: "rows", //arry containing actual data  
              page: "page", //current page  
              total: "total", //total pages for the query  
              records: "records", //total number of records  
              repeatitems: false,  
              id: "ID" //index of the column with the PK in it   
          },
          colNames: ['Name', 'Title'],
          colModel: [
        { name: 'name', index: 'name', width: 250 },
        { name: 'title', index: 'title', width: 250 }
        ],
          pager: '#pager',
          rowNum: 10,
          rowList: [10, 20, 30],
          sortorder: "desc",
          viewrecords: true,
          height: '250px',
          caption: 'My first grid',
          loadonce: true
      }).navGrid('#pager', {edit: false, add: false, del: false});
  });
  
  function processrequest(postdata) {
  ...
  $.ajax({
  ...
      complete: function (jsondata, stat) {
          if (stat == "success") {
              var thegrid = jQuery("#list2")[0];
              var jsonObject = (eval("(" + jsondata.responseText + ")"));
              thegrid.addJSONData(jsonObject.d);
              $(".loading").hide();
          } else {
              $(".loading").hide();
              alert("Error with AJAX callback");
          }
          $("#list").setGridParam({ datatype: 'local' });
      }
  });
  }
  </code></pre>