© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago
w5m

Sortable TextColumn based on Enum labels rather than query

I'm currently using a
TaskStatus
TaskStatus
enum which implements the
HasLabel
HasLabel
contract. In this enum I've defined an
orderedLabels()
orderedLabels()
method to return an array of enum cases ordered by the corresponding labels.

I've successfully utilised the enum in a form and in a table...

TextColumn::make('task_status_id')
    ->label('Status')
    ->sortable()
    ->badge(), 
TextColumn::make('task_status_id')
    ->label('Status')
    ->sortable()
    ->badge(), 


What I would ideally like to do is pass something into the
sortable()
sortable()
method of the
TextColumn
TextColumn
which allows me to specify how to order the enum (as it currently orders by the
task_status_id
task_status_id
DB table field, an integer, which corresponds to an int-backed enum case).

Other than backing the enum cases with integers which match alphabetical order, is there a way I could specify that sorting for this column should be done in alphabetical order of enum labels rather than via a query?
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
How to display an enum's label rather than value in a TextColumn?
FilamentFFilament / ❓┊help
3y ago
Using closure with sortable on TextColumn
FilamentFFilament / ❓┊help
3y ago
How to Enum on TextColumn method?
FilamentFFilament / ❓┊help
3y ago