title: Best way to change jqGrid rowNum from ALL to -1 before pass to a web service
body: <p>I'm looking to find the best way to allow users to choose to show ALL records in a jqGrid.  I know that a -1 value passed for the rows parameter denotes ALL, but I want the word "ALL" not a -1 to appear in the rowList select element, ie. rowList: [15, 50, 100, 'ALL'].</p>
  
  <p>I'm passing the grid request to a web service which accepts an int for "rows", and I'm trying find how and when I should change the user selected value of "ALL" to a -1 before it gets sent to the web service.</p>
  
  <p>Below is my cleaned up grid code.  I tried some various code blocks before my $.ajax in the datatype function.  But most attempts just seemed like I have to be doing this the most convoluted way I possibly could.  For example,</p>
  
  <pre><code>datatype: function(postdata) {
     if ($("#gridTableAssets").jqGrid('getGridParam', 'rowNum') == 'ALL') {
        $("#gridTableAssets").appendPostData({ "rows": -1, "page": 1 });
     }
     $.ajax({...
  </code></pre>
  
  <p>But doing that seemed to cause the actual "page" GridParam to be nulled out on subsequent grid actions, forcing me handle that in other places.  There just seems like this is something that would be frequently done out there and have clean way of doing it.</p>
  
  <p><strong>Cleaned grid code:</strong></p>
  
  <pre><code>$("#gridTableAssets").jqGrid({
      datatype: function(postdata) {
         $.ajax({
             url: "/Service/Repository.asmx/GetAssets",
             data: JSON.stringify(postdata),
             type: 'POST',
             contentType: "application/json; charset=utf-8",
             error: function(XMLHttpRequest, textStatus, errorThrown) {
                alert('error');
             },
             success: function(msg) {
                var assetsGrid = $("#gridTableAssets")[0];
                assetsGrid.addJSONData(JSON.parse(msg));
                ...
             }
         });
      },
      ...
      pager: $('#pagerAssets'),
      rowNum: 15,
      rowList: [15, 50, 100, 'ALL'],
      ...                    
      onPaging: function(index, colindex, sortorder) {
         SessionKeepAlive();
      }
  });
  </code></pre>
  
  <p>And here is the web service</p>
  
  <pre><code>[WebMethod]
  public string GetAssetsOfAssetStructure(bool _search, int rows, int page, 
      string sidx, string sord, string filters)
  </code></pre>