Skip to content

Commit

Permalink
fix sort
Browse files Browse the repository at this point in the history
  • Loading branch information
JCrombez committed Jul 28, 2022
1 parent 2f846b6 commit c3a113d
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/Grid/GridBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,14 @@ public function addFilter(string $formFieldName, callable $callback): self

private function applySort()
{
foreach ($this->columns as $column) {
if ($column->sortable === null) {
continue;
}

$sortBy = $this->request->get('sort_by');
$direction = $this->request->get('sort_order', 'ASC');

if ($sortBy === null) {
continue;
}
$sortBy = $this->request->get('sort_by');
$direction = $this->request->get('sort_order', 'ASC');

$this->queryBuilder->orderBy($column->sortable, $direction);
if ($sortBy === null) {
return;
}

$this->queryBuilder->orderBy($sortBy, $direction);
}

private function applyFilters()
Expand Down

0 comments on commit c3a113d

Please sign in to comment.