© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•6mo ago•
3 replies
delboy1978uk

refresh select filter that uses an attribute

I have a
SelectFilter
SelectFilter
which filters upon status as follows:
                    SelectFilter::make('status')
                    ->label('Status')
                    ->options([
                        __('mesco.produced') => __('mesco.produced'),
                        __('mesco.partially produced') => __('mesco.partially produced'),
                        __('mesco.planned') => __('mesco.planned'),
                        __('mesco.new') => __('mesco.new'),
                    ])
                    ->query(function ($query) {
                        $status = Request::get('tableFilters')['status']['value'] ?? null;
                        if ($status) {
                            return $query->withStatus($status);
                        }
                    })
                    SelectFilter::make('status')
                    ->label('Status')
                    ->options([
                        __('mesco.produced') => __('mesco.produced'),
                        __('mesco.partially produced') => __('mesco.partially produced'),
                        __('mesco.planned') => __('mesco.planned'),
                        __('mesco.new') => __('mesco.new'),
                    ])
                    ->query(function ($query) {
                        $status = Request::get('tableFilters')['status']['value'] ?? null;
                        if ($status) {
                            return $query->withStatus($status);
                        }
                    })

The
status
status
which we are checking is not in the DB, it is an attribute, which is why I alter the query. In my model:
public function getStatusAttribute(): string
    {
        // returns calculated status
    }

    public function scopeWithStatus($query, $status)
    {
        // alters query
    }
public function getStatusAttribute(): string
    {
        // returns calculated status
    }

    public function scopeWithStatus($query, $status)
    {
        // alters query
    }

The filter works, but only after I refresh the page. Upon applying the filter, everything shows, once I refresh, the filtered records are shown.

How can I tell filament to refresh the table data again, or even simply to refresh/reload the entire page, opnce the filter has been applied?
Solution
maybe you can inject
array $data
array $data
?
You can also use custom filter forms
Custom filters - Tables - Filament
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Select filter attribute name by relation
FilamentFFilament / ❓┊help
12mo ago
Select make on attribute that is an array
FilamentFFilament / ❓┊help
15mo ago
refresh after filter
FilamentFFilament / ❓┊help
13mo ago
How implement a filter in a filament resource that uses the attribute of a HasOne relationship
FilamentFFilament / ❓┊help
3y ago