From 6f5bdc66eeedf50f9385ed29d7a3baf4b83e71cb Mon Sep 17 00:00:00 2001 From: Joe <104938042+lrljoe@users.noreply.github.com> Date: Sat, 10 Aug 2024 03:35:16 +0100 Subject: [PATCH] Fix sort array url query (#1835) * Fix SortingHelpers * Fix styling --------- Co-authored-by: lrljoe --- CHANGELOG.md | 4 ++++ src/Traits/Helpers/SortingHelpers.php | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11b79fdde..0ac54b890 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to `laravel-livewire-tables` will be documented in this file +## [v3.4.5] - 2024-08-10 +### Bug Fixes +- Fix sort queryString bug by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1835 + ## [v3.4.4] - 2024-08-10 ### New Features - Boolean/Toggle Filter by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1830 diff --git a/src/Traits/Helpers/SortingHelpers.php b/src/Traits/Helpers/SortingHelpers.php index b9ea81ba1..c78ec9a2f 100644 --- a/src/Traits/Helpers/SortingHelpers.php +++ b/src/Traits/Helpers/SortingHelpers.php @@ -19,6 +19,16 @@ public function getSingleSortingStatus(): bool public function getSorts(): array { + foreach ($this->sorts as $column => $direction) { + if (is_array($direction)) { + foreach ($direction as $colAppend => $actualDirection) { + $this->sorts[$column.'.'.$colAppend] = $actualDirection; + unset($this->sorts[$column]); + } + } + + } + return $this->sorts; }