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?5 replies