up
Jul 14, 2023
3
Level 1
bug in sorting values in filament table
I have the name column in a filament table with sortable(), but it is sorting wrong example: group 1, group 2, group 3, group 7, group 10
he commands:
group 1, group 10, group 2, group 3, group 7
TextColumn::make('name') ->limit(20) ->searchable() ->sortable() ->label(__('campaign::group.group_name')),
Level 21
This is due to the fact that it is sorted aplhabetically/as a string and not like numbers. One way to fix it is to have leading zeros and therefore group 01, group 02 ...
This can be done automatically with str_pad str_pad($value, 2, '0', STR_PAD_LEFT);
Hope it helps !
1 like
Please or to participate in this conversation.