© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•16mo ago•
1 reply
tobeans

How can I sort by value string on table?

TextColumn::make('source')->sortable(query: fn (Builder $query, string $direction) => $query
->orderByRaw(<<<SQL
CASE WHEN source = 'A' THEN 1 ELSE 0 END {$direction}, source {$direction}
SQL)
),

Here is my current code, I am trying to prioritise or order the table so it's by sourced and the given value that equals source must be first then the rest. Nothing is working so far, I've tried multiple ways. Please help. TIA
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

How to sort table by relationship?
FilamentFFilament / ❓┊help
15mo ago
Sort table by random order
FilamentFFilament / ❓┊help
16mo ago
How can I sort a table on a custom page?
FilamentFFilament / ❓┊help
3y ago
Can I sort table on non-column data
FilamentFFilament / ❓┊help
15mo ago