Skip to content

Commit

Permalink
Fix paginator defaulting for multi-default-sort.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Nov 9, 2018
1 parent 21c8fce commit 756cf7e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Datasource/Paginator.php
Expand Up @@ -221,7 +221,7 @@ public function paginate($object, array $params = [], array $settings = [])
'nextPage' => $count > ($page * $limit),
'pageCount' => $pageCount,
'sort' => $options['sort'],
'direction' => current($order),
'direction' => isset($options['sort']) ? current($order) : null,
'limit' => $defaults['limit'] != $limit ? $limit : null,
'sortDefault' => $sortDefault,
'directionDefault' => $directionDefault,
Expand Down
1 change: 1 addition & 0 deletions src/View/Helper/PaginatorHelper.php
Expand Up @@ -436,6 +436,7 @@ public function sort($key, $title = null, array $options = [])

$title = __(Inflector::humanize(preg_replace('/_id$/', '', $title)));
}

$defaultDir = isset($options['direction']) ? strtolower($options['direction']) : 'asc';
unset($options['direction']);

Expand Down

0 comments on commit 756cf7e

Please sign in to comment.