diff --git a/calendar/inc/class.calendar_uilist.inc.php b/calendar/inc/class.calendar_uilist.inc.php index 25e5a4dd15..852157363a 100644 --- a/calendar/inc/class.calendar_uilist.inc.php +++ b/calendar/inc/class.calendar_uilist.inc.php @@ -256,7 +256,7 @@ class calendar_uilist extends calendar_ui if ($old_params['filter'] && $old_params['filter'] != $params['filter']) // filter changed => order accordingly { $params['order'] = 'cal_start'; - $params['sort'] = $params['filter'] == 'after' ? 'ASC' : 'DESC'; + $params['sort'] = $params['filter'] == 'before' ? 'DESC' : 'ASC'; } if ($old_params['search'] != $params['search']) { @@ -286,9 +286,12 @@ class calendar_uilist extends calendar_ui 'query' => $params['search'], 'offset' => (int) $params['start'], 'num_rows'=> $params['num_rows'], - 'order' => $params['order'] ? $params['order'].' '.$params['sort'] : 'cal_start', + 'order' => $params['order'] ? $params['order'].' '.$params['sort'] : 'cal_start ASC', 'cfs' => $params['csv_export'] ? array() : $cfs, ); + // Non-blocking events above blocking + $search_params['order'] .= ', cal_non_blocking DESC'; + switch($params['filter']) { case 'all': diff --git a/calendar/js/app.js b/calendar/js/app.js index 7954cd7fe2..48da75f9cd 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -1217,6 +1217,15 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend( if(filter) { app.calendar.state.filter = filter.getValue(); + // Change sort order for before - this is just the UI, server does the query + if(app.calendar.state.filter == 'before') + { + view.getWidgetById('nm').sortBy('cal_start',false, false); + } + else + { + view.getWidgetById('nm').sortBy('cal_start',true, false); + } } else {