F
Filamentβ€’2mo ago
Daniele

Reordering a table with a 0-based index

Heya everyone! We're on Filament v3 and we're using the ->reorderable() method on a Resource Table to allow the reordering of the elements. It works great, but for our use case we would prefer if the result ordering started with 0 instead of 1. For example, reordering 3 elements right now results in: 1 - Element A 2 - Element B 3 - Element C While we'd like to have: 0 - Element A 1 - Element B 2 - Element C I've tried to look around in the Filament code and I believe the reordering happens here ( https://github.com/filamentphp/filament/blob/45b59301b05c8603418c25fc2f2a407cd2f904cf/packages/tables/src/Concerns/CanReorderRecords.php#L15-L51 ), but I can't see how to obtain what we'd like to do. Is there a way to do it?
GitHub
filament/packages/tables/src/Concerns/CanReorderRecords.php at 45b5...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
Solution:
You'd need to overwrite that whole method if you like a different behaviour
Jump to solution
2 Replies
Solution
Dennis Koch
Dennis Kochβ€’2mo ago
You'd need to overwrite that whole method if you like a different behaviour
Daniele
Danieleβ€’2mo ago
Alright guessed as much, thanks anyway πŸ‘
Want results from more Discord servers?
Add your server
More Posts