rappasoft / laravel-livewire-tables

A dynamic table component for Laravel Livewire
https://rappasoft.com/docs/laravel-livewire-tables/v2/introduction
MIT License
1.76k stars 330 forks source link

[Bug]: Sorting deep relations #1546

Closed levizoesch closed 9 months ago

levizoesch commented 11 months ago

What happened?

If you sort a column that is a deep relation, the url param will be [filter][value] where as it should be [filter.value].

How to reproduce the bug

Column::make('Bank','bank.alias') ->searchable() ->sortable() ->collapseOnMobile(),

image vs image

Package Version

3.x

PHP Version

8.1.x

Laravel Version

10.x

Error Message

Rappasoft\LaravelLivewireTables\Views\Column::getSortingPillDirection(): Argument https://github.com/rappasoft/laravel-livewire-tables/issues/2 ($direction) must be of type string, array given, called in /home/.../storage/framework/views/b496047e5597363e8385316850f702ff.php on line 134 (View: /home/.../vendor/rappasoft/laravel-livewire-tables/resources/views/components/tools/sorting-pills.blade.php)

lrljoe commented 11 months ago

Possible fix, needs further testing

stale[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

yogiri commented 8 months ago

We're facing the same issue. Was there a fix to it?

EDIT: This happens only when using a filter AFTER applying a sort. If the filter is applied before the sorting, then it doesn't break.

levizoesch commented 5 months ago

We're facing the same issue. Was there a fix to it?

EDIT: This happens only when using a filter AFTER applying a sort. If the filter is applied before the sorting, then it doesn't break.

Yes this bug has been resolved in later versions of both Livewire, and Livewire Tables.

This bug was a issue particularly with Livewire changes early on in 3.0, and how Livewire Tables was handling things.