title: jqGgrid: mutli-level grouping summary value
body: <p>My objective is to perform multi-level grouping in jqGrid and add summary footer for each level.</p>
  
  <p>I have used the code in their official website for dynamically change the grouping which I extended to do a dynamic three level grouping. </p>
  
  <p>I have created 3 combobox to choose the column name related to the grouping of each level. </p>
  
  <p>I have achieved the mutli level grouping but I have problem here that the summary footer is per page and not the total sum of all rows in each group.  </p>
  
  <p>I have tried several solutions:
  one of them, the solution implemented in this link <a href="http://www.guriddo.net/demo/guriddojs/grouping/summary_and_grand_total/index.html" rel="nofollow noreferrer">http://www.guriddo.net/demo/guriddojs/grouping/summary_and_grand_total/index.html</a> but It's not worked for me.</p>
  
  <p>I tried to customize the summaryType function to calculte the sum rows for each group on the client side but I can't.</p>
  
  <p>Now, I have prepared the list grouped by the first level on server side and then I get it in client side to fill the summury footer by using "userdata".
  this is my function:</p>
  
  <pre><code>var sumArraySearch = [];
  var criteria = '';// column name selected  in Combobox to do the grouping
  function sumSearch(val, name, record)
  {
      if(init == 0){
          //  console.log ($("#griddata").jqGrid('getGridParam','userData').rows);
          var rows = $("#griddata").jqGrid('getGridParam','userData').rows;
          var size = $("#griddata").jqGrid('getGridParam','userData').rows.length;
           for (var i = 0; i &lt; size; i++) {
              sumArraySearch[rows[i][criteria]]= rows[i]['brutto'];
  
           }
           init ++;
       }
      return sumArraySearch[record[criteria]];
  }
  </code></pre>
  
  <p>And I have blocked now, if I send 2 lists from server: the first is the data grouped by the first level and the second is the data grouped by the second level how can I get the correct sum for each group since the sum is returned by one function?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I have prepared a <a href="https://jsfiddle.net/nayoumi/d2v0neo5/36/" rel="nofollow noreferrer">JSFiddle </a>demo to demonstrate the problem. </p>