filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
19.4k stars 2.97k forks source link

Reordering records when default order direction should be descending #14649

Open naturalGroove opened 3 weeks ago

naturalGroove commented 3 weeks ago

Package

filament/filament

Package Version

v3.2.117

Laravel Version

v11.29.0

Livewire Version

v3.5.12

PHP Version

PHP 8.2.22

Problem description

Problem related to using Spatie's SortableTrait in the project

When we set the reorderable() parameter for the table and when we need the records on the page to appear in descending order, we cannot correctly set the order for the items in the reorder view. I hope it sounds somewhat understandable ;)

Unfortunately, I did not find a solution to this problem in the table configuration options in the resource class. I have a certain solution to this problem, here is a link to the repository:

https://github.com/naturalGroove/filament/tree/add-more-reorderable-configuration

Expected behavior

Ability to display records in descending order in the reorder view and correctly save the order in the database.

Steps to reproduce

Install the repository below and try to reorder Posts.

Make sure to:

migrate + seed database login using email - pw: test@example.com - test

Reproduction repository (issue will be closed if this is not valid)

https://github.com/naturalGroove/filament-reorderable-when-order-is-desc

Relevant log output

No response

Donate 💰 to fund this issue

Fund with Polar