Skip to content

Commit

Permalink
v3 - Apply Reorder Sorting When Reordering (#1402)
Browse files Browse the repository at this point in the history
* Fix for reorder sort not applying

* Fix styling

---------

Co-authored-by: lrljoe <[email protected]>
  • Loading branch information
lrljoe and lrljoe authored Oct 8, 2023
1 parent 323deee commit 429b54f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
- Removes superfluous @endphp from the DateRangeFilter blade
- Removes reference to remote/published 3rd party assets
- Add setFilterLabelAttributes Capability Per-Filter
- Fix for reorder sort not applying automatically

## [3.0.0-beta.0] - 3.x Initial Release
- Amending Documentation for Reordering
Expand Down
7 changes: 6 additions & 1 deletion src/Traits/WithData.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ protected function executeQuery(): Collection|CursorPaginator|Paginator|LengthAw
// Moved these from baseQuery to here to avoid pulling all fields when cloning baseQuery.
$this->setBuilder($this->selectFields());

$this->applySorting();
if ($this->currentlyReorderingIsEnabled()) {
$this->setBuilder($this->getBuilder()->orderBy($this->getDefaultReorderColumn(), $this->getDefaultReorderDirection()));
} else {
$this->applySorting();

}

if ($this->paginationIsEnabled()) {
if ($this->isPaginationMethod('standard')) {
Expand Down

0 comments on commit 429b54f

Please sign in to comment.