© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
14 replies
hentiru

Numeric TextColumn: sortable() not working properly

Hi, I've faced this issue: sortable() method change randomly the order of the column with numeric field. It doesn't even give an "alphabetical" order on numbers. it was simply random (or in any case not a recognizable order, I couldn't find a pattern...)

I found a solution passing sortable as in the code below, but I wonder if it's a known behavior and it's what you guys thought, maybe someone has some insights?

return TextColumn::make('priority')
->label('')
->html()
->state('●')
->sortable(query: function(Builder $query, string $direction): Builder {
$query->getQuery()->orders = [];
$query->orderBy('priority', $direction);

return $query;
})
->size(TextColumnSize::Large)
->color(fn (Order $record): string => match (self::determinePriority($record->priority)) {
'high' => 'danger',
'medium' => 'warning',
'low' => 'info',
default => 'gray',
});

FYI: I tried adding numeric(), removing html(), removing state() showing the numbers to try understanding the pattern and it didn't work...
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

TextColumn::sortable() issue
FilamentFFilament / ❓┊help
3y ago
Using closure with sortable on TextColumn
FilamentFFilament / ❓┊help
3y ago
TextColumn action not working as expected
FilamentFFilament / ❓┊help
2y ago
Sortable() on One-of-Many column not sorting properly
FilamentFFilament / ❓┊help
2y ago