title: Group By data on the basis of Service Code and display data using Jquery Datatable
body: <p>What I want is, I want to group by Data based on <code>Service code</code> coming from datatable. I want to group by the selected value from the <code>datatable</code>.</p>
  
  <p>Below is my Datatable screenshot</p>
  
  <p><a href="https://i.stack.imgur.com/OpOD3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OpOD3.png" alt="Datatable"></a></p>
  
  <p>In above picture I have checked four checkboxes. So I want to <code>groupBy</code> those 4 columns data based on the <code>Service Code</code>.</p>
  
  <p>Suppose, the Service code for first two checked rows are <code>3297392</code> and for other two checked are <code>3293490</code> So it should display my datatable something like below</p>
  
  <p><a href="https://i.stack.imgur.com/6meSo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6meSo.png" alt="Display Data"></a></p>
  
  <p>With grouping it also is adding SAP ID column and ASSETS COUNT.</p>
  
  <p>I am unable to get the exact logic for that, but something which I tried is like below</p>
  
  <pre><code>function ViewGroupBySummaryData() {
  
  var tableToViewSummary = $('#confirmToFECertify');
  tableToViewSummary.empty();
  
  var table = $(dtCertifyEFO).DataTable();
  var data = table.rows('.selected').data();   
  }
  </code></pre>
  
  <p>In <code>data</code> I get the values of selected row but without columns.</p>
  
  <p>The data is like below in console</p>
  
  <p><code>0:(14)[<br>
     "",
     "&lt;a class="   actionIcon" id="discripancy"&gt;&lt;i class="fa fa-flag"&gt;&lt;/i&gt;&lt;/a&gt;",
     "I-AP-APRR-ENB-B002",
     "INAPAPRRIDETTW6001",
     "GANESH NAGAR_AT2001",
     "",
     "3297392",
     "MAINTENANCE OF IP COLO ENODEB SITE / IP Colo",
     "ACTIVE",
     "12/11/2014",
     "",
     "Mahindra &amp;amp; Mahindra Limited - 168888",
     "",
     ""
  ]1:(14)[<br>
     "",
     "&lt;a class="   actionIcon" id="discripancy"&gt;&lt;i class="fa fa-flag"&gt;&lt;/i&gt;&lt;/a&gt;",
     "I-AP-APRR-ENB-G001",
     "INAPAPRRYRNLNB6001",
     "VENUGOPAL NAGAR",
     "",
     "3297392",
     "MAINTENANCE OF IP COLO ENODEB SITE / IP Colo",
     "ACTIVE",
     "12/11/2014",
     "",
     "Mahindra &amp;amp; Mahindra Limited - 168888",
     "",
     ""
  ]2:(14)[<br>
     "",
     "&lt;a class="   actionIcon" id="discripancy"&gt;&lt;i class="fa fa-flag"&gt;&lt;/i&gt;&lt;/a&gt;",
     "I-AP-BRYS-ENB-6000",
     "INAPBRYSBRYSTW6001",
     "Bukkarayasamudram",
     "",
     "3293490",
     "MAINTENANCE OF RCOM COLO ENODEB SITE / R-Colo",
     "ACTIVE",
     "12/11/2014",
     "",
     "Mahindra &amp;amp; Mahindra Limited - 168888",
     "",
     ""
  ]3:(14)[<br>
     "",
     "&lt;a class="   actionIcon" id="discripancy"&gt;&lt;i class="fa fa-flag"&gt;&lt;/i&gt;&lt;/a&gt;",
     "I-AP-BRYS-ENB-6001",
     "INAPBRYSXXXXTW6003",
     "CHENNAMPALLE",
     "",
     "3293490",
     "MAINTENANCE OF RCOM COLO ENODEB SITE / R-Colo",
     "ACTIVE",
     "12/11/2014",
     "",
     "Mahindra &amp;amp; Mahindra Limited - 168888",
     "",
     ""
  ]</code></p>
  
  <p>Please help me to build the logic using jquery datatable.</p>
  
  <p>Below is my HTML</p>
  
  <pre><code>&lt;table id="confirmToFECertify" class="myTable table table-striped table-bordered nowrap" cellspacing="0"&gt;&lt;/table&gt;
  </code></pre>