CRM_Utils_JSON::output($groups);
}
else {
-
- $sortMapper = array();
- $columns = CRM_Utils_Array::value('columns', $params, array());
- foreach ($columns as $key => $value) {
- $sortMapper[$key] = $value['data'];
- }
-
- $offset = isset($_GET['start']) ? CRM_Utils_Type::escape($_GET['start'], 'Integer') : 0;
- $rowCount = isset($_GET['length']) ? CRM_Utils_Type::escape($_GET['length'], 'Integer') : 25;
- $sort = isset($_GET['order'][0]['column']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_GET['order'][0]['column'], 'Integer'), $sortMapper) : NULL;
- $sortOrder = isset($_GET['order'][0]['dir']) ? CRM_Utils_Type::escape($_GET['order'][0]['dir'], 'String') : 'asc';
-
- if ($sort && $sortOrder) {
- $params['sortBy'] = $sort . ' ' . $sortOrder;
- }
-
- $params['page'] = ($offset / $rowCount) + 1;
- $params['rp'] = $rowCount;
+ $params = CRM_Core_Page_AJAX::defaultSortAndPagerParams();
// get group list
$groups = CRM_Contact_BAO_Group::getGroupListSelector($params);