code: function getGroups(params) {
  
                      var group = params.group();
                      var groupFn;
                      var sortDirection = undefined;
                      if (angular.isFunction(group)) {
                          groupFn = group;
                          sortDirection = group.sortDirection;
                      } else {
                          // currently support for only one group implemented
                          var groupField = Object.keys(group)[0];
                          sortDirection = group[groupField];
                          groupFn = function(item){
                              return item[groupField];
                          };
                      }
  
                      var settings = params.settings();
                      var originalDataOptions = settings.dataOptions;
                      settings.dataOptions = { applyPaging: false };
                      var adaptedFn = settings.getDataFnAdaptor(settings.getData);
                      var gotData = $q.when(adaptedFn.call(settings, params));
                      return gotData.then(function(data) {
                          var groups = {};
                          angular.forEach(data, function(item) {
                              var groupName = groupFn(item);
                              groups[groupName] = groups[groupName] || {
                                      data: [],
                                      $hideRows: !settings.groupOptions.isExpanded,
                                      value: groupName
                                  };
                              groups[groupName].data.push(item);
                          });
                          var result = [];
                          for (var i in groups) {
                              result.push(groups[i]);
                          }
                          if (sortDirection) {
                              var orderByFn = ngTableDefaultGetData.getOrderByFn();
                              var orderBy = convertSortToOrderBy({
                                  value: sortDirection
                              });
                              result = orderByFn(result, orderBy);
                          }
  
                          return ngTableDefaultGetData.applyPaging(result, params);
                      }).finally(function(){
                          // restore the real options
                          settings.dataOptions = originalDataOptions;
                      });
                  }
docs: @ngdoc method
  @name settings#getGroups
  @description Return groups of data to display in the table
  
  Called by `NgTableParams` whenever it considers new data is to be loaded
  and when a `group` value has been assigned
  
  @param {Object} params the `NgTableParams` requesting data