In my controller I have my pagination set to order by 2 fields.
public $paginate = [
'limit' => 50,
'order' => ['first_name', 'last_name']
];
$contacts = $this->paginate($this->Contacts);
This works fine on the first page, but since I left out the default direction => 'ASC'
the Paginator links don't work at all:
/contacts?page=2&sort=0&direction=first_name
When I add in the direction, it works, but of course only sorts by the first field, messing up the sort order.
/contacts?page=2&sort=Contacts.first_name&direction=ASC
- Should the default direction be explicitly required?
- Is there a method to maintain both fields for sorting during pagination?
Sorting by virtual fields (e.g. full_name => first_name . ' ' . last_name
) doesn't work as it did in 2.x
Paginator->prev('< ' . __('previous')) ?> Paginator->numbers() ?> Paginator->next(__('next') . ' >') ?>
Paginator->counter() ?>