Is it possible to hook to the table reorder event, when someone clicks the tick after reordering?
I would like to do a few checks after the tick/check icon is clicked
5 Replies
there is no hook atm but you could override reorderTable() on the list page
Let me try this
Still no hook in 2025? It's frustrating because when using Spatie Elequent-Sortable, that package's ::newSortOrder() never gets triggered by Filament so we can't listen for the table sorting event on completion. Feature Request?!? @Dan Harrin
So I tried to hook into a model event with ... ->wasChanged('order_column') doesn't work either, so it's impossible to work with table sorting events.
Is your intention to come across as demanding?!?
No, there is no hook at the moment. You can extend the method on the List/RelationManager class, or submit a PR for something like
$table->afterReorder(fn () => ...)
to v4
No, my intention was not meant to be in anyway demanding.
For anyone looking to fire the Spatie table sorting event like I was, here is some working code:
(this is for a relation-manager)
I have no idea if this is the best way to do this, but the
EloquentModelSortedEvent
is fired.
I removed parent::reorderTable($order, $draggedRecordKey);
because then the update queries are unnecessarily run twice.