30 Nov 20173 minutes to read

Grouping technique is also supported in DataManager. When you want to analyze any particular record based on its category simply you can group that column and analyze the records based on category. The following code example illustrates the grouping behavior in table.

  • HTML
  • <div class="datatable">
       <table id="table1" class=" table table-striped table-bordered" style="width:700px">
                <th>Order ID</th>
                <th>Customer ID</th>
                <th>Employee ID</th>
                <th>Ship Country</th>
    <script type="text/javascript">
       $(function () {// Document is ready.
           //oData Adaptor with DataManager
           var dataManager = ej.DataManager({
               url: ""
           var query = ej.Query()            
               .from("Orders").select("OrderID", "CustomerID", " EmployeeID", "Freight", "ShipCountry")
           var execute = dataManager.executeQuery(query) // executing query
                  .done(function (e) {
                      $("#table1 tbody").html($("#groupTemplate").render(e.result));
    <script id="groupTemplate" type="text/x-jsrender">
       <tr class='caption'>
           <th>Key: </th>
           <th colspan='3'>
               Count: 8</th>
    <script id="tableTemplate" type="text/x-jsrender">

    Result of the above code example is illustrated as follows.