title: jqgrid auto sorting the data on grouped column, how can this be turned off?
body: <p>I have a jqgrid with grouping, however the data coming back from the server is already grouped, I simply want to apply the jqgrid grouping look to the data.  I've included a jsfiddle since a picture speaks 1000 words.  THE DATA IS INCLUDED IN THE FIDDLE...</p>
  
  <p>Link to fiddle : <a href="http://jsfiddle.net/Rab815/p8Zsk/" rel="nofollow noreferrer">http://jsfiddle.net/Rab815/p8Zsk/</a></p>
  
  <pre><code>$('table').jqGrid({
      data: data,
      datatype: "local",
      rowNum:100,
      gridview: true,
      deepempty: true, 
      hoverrows: false, 
      headertitles: true,
      height:'600px',
      viewrecords:true,
      hoverrows: true,
      sortable: true,
      altRows: true,
      colModel: [
          { label: "Group Name", name:'groupName', field:"groupName", sortable:false},
          { label: 'Name', field: 'name', name:'name' },
          {
              label: 'Date Modified', field: 'lastGenerated', name:'lastGenerated'
          }
      ],
      grouping:true,
      groupingView:
          {
              groupField: ['groupName'],
              groupColumnShow: [true], 
              groupCollapse: true,
          },
      shrinkToFit: false
  });
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/QCZw5.jpg" alt="enter image description here"></p>
  
  <p>However I need it displayed in this order</p>
  
  <p><img src="https://i.stack.imgur.com/hHlVF.jpg" alt="enter image description here"></p>
  
  <p>Now, if you put the data in an editor so each block appears on one line, the data is already coming back grouped from the DB in the order I want it to appear.  but the grid is sorting the groupName data field in 'asc' order and far as I can tell it can't be turned off.</p>
  
  <p>The Grouping Column would eventually be set to groupColumnShow: [false]</p>
  
  <p><strong>ANSWER from Olegs FIDDLE...</strong></p>
  
  <p>Included a </p>
  
  <blockquote>
    <p>groupOrder</p>
  </blockquote>
  
  <p>in the data coming from the server rather than doing the mapping.</p>
  
  <p>Altered ColModel for GroupName as follows</p>
  
  <pre><code>{
      label: "Group Name", field: "groupName",
      sorttype: function (cellValue, obj) {
                      return obj.groupOrder;
                      //return groupOrder[obj.groupId];
  }
  </code></pre>
  
  <p>Now everything appears in the correct order.  This solution allows the sort, which defaults to "asc" in jqgrid to order the grouped data by a different value other than the grouped data itself.</p>
  
  <p>Thanks!  This had me stumped for quite a while!</p>