title: How to group by multiple columns, jquery datatables
body: <p>Starting from <a href="https://datatables.net/examples/advanced_init/row_grouping.html" rel="nofollow noreferrer">datatables-row_grouping</a></p>
  
  <p>I have a business requirement to format a datatable where results are grouped by 2 columns.</p>
  
  <p>This is what I have for my datatable config which does produce results close to what I need, however I can't get the value of the second column.</p>
  
  <p>The api.column(1 below is referencing the first column, i need column two (2) as well. I tried columns([1, 2] and expected to get an array of results for .each() but that was a failure.</p>
  
  <pre><code>var dtOptions = {
      "dom": '&lt;"clearfix"&gt;&lt;"pull-left"l&gt;&lt;"pull-right"Bf&gt;r&lt;"horizontal-scroll"t&gt;&lt;"pull-left"i&gt;&lt;"pull-right"p&gt;&lt;"clearfix"&gt;',
      "pageLength": 10,
      "paging": true,
      "columnDefs": [
      {
          "targets": groupCols, /// this is an array [1, 2]
          "visible": false
      }],
      "order": [[1, 'asc']],
      "displayLength": 15,
      "drawCallback": function ( settings ) {
          var api = this.api();
          var rows = api.rows( {page:'current'} ).nodes();
          var last = null;
  
          api.column(1, { page: 'current' }).data().each(function (group, i) {
              if (last !== group) {
  
                  $(rows).eq(i).before(
                      '&lt;tr class="group"&gt;&lt;td colspan="3"&gt;' + group + '&lt;/td&gt;&lt;td colspan="14"&gt;' + need_second_column_string_here + '&lt;/td&gt;&lt;/tr&gt;'
                  );
  
                  last = group;
              }
          });
      }
  }
  </code></pre>
  
  <p>Thanks for any assistance.</p>