add default-sorting of listings in frontend

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-09-30 09:44:11 +02:00
parent fa826aa87e
commit e944a886b6
40 changed files with 51 additions and 26 deletions

View File

@@ -109,7 +109,7 @@ class Collection
return $this;
}
public function withPagination(array $columns): Collection
public function withPagination(array $columns, array $default_sorting = []): Collection
{
// Get only searchable columns
/*
@@ -122,7 +122,7 @@ class Collection
*/
// Prepare pagination
$this->pagination = new Pagination($columns, $this->count(), (int)Settings::Get('panel.paging'));
$this->pagination = new Pagination($columns, $this->count(), (int)Settings::Get('panel.paging'), $default_sorting);
$this->params = array_merge($this->params, $this->pagination->getApiCommandParams());
return $this;