© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•13mo ago•
1 reply
H.Bilbao

Update table actions when change filter

I need to change the visibility of the actions when I change the filter. I have the following code so that it is not calculating the state in each record, but it does not update the visibility of the button until I refresh with F5 or click any action. If I do the find on each record it generates a large number of unnecessary queries.

protected function getTableActions(): array
    {
        $this->initializePermissions();

        // Retrieve the auth_status value
        $legAuthStatus = $this->record->legs->find($this->getTableFilterState('leg')['value'])->auth_status ?? null;
        $isNotOfficial = $legAuthStatus != EntryListEnum::Official;

        return [
            Tables\Actions\ViewAction::make()
                ->iconButton()
                ->modalWidth(MaxWidth::Medium),
            Tables\Actions\EditAction::make()
                ->iconButton()
                ->modalWidth(MaxWidth::Medium)
                ->visible(fn($record, $livewire) => $this->canEditAuthorization && $isNotOfficial),
            Tables\Actions\DeleteAction::make()
                ->iconButton()
                ->visible(fn($record, $livewire) => $this->canDeleteAuthorization && $isNotOfficial),
        ];
    }
protected function getTableActions(): array
    {
        $this->initializePermissions();

        // Retrieve the auth_status value
        $legAuthStatus = $this->record->legs->find($this->getTableFilterState('leg')['value'])->auth_status ?? null;
        $isNotOfficial = $legAuthStatus != EntryListEnum::Official;

        return [
            Tables\Actions\ViewAction::make()
                ->iconButton()
                ->modalWidth(MaxWidth::Medium),
            Tables\Actions\EditAction::make()
                ->iconButton()
                ->modalWidth(MaxWidth::Medium)
                ->visible(fn($record, $livewire) => $this->canEditAuthorization && $isNotOfficial),
            Tables\Actions\DeleteAction::make()
                ->iconButton()
                ->visible(fn($record, $livewire) => $this->canDeleteAuthorization && $isNotOfficial),
        ];
    }


Thanks
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

update actions on filter change
FilamentFFilament / ❓┊help
3y ago
Add table filter to header actions
FilamentFFilament / ❓┊help
2mo ago
Change default message when filtered table empty
FilamentFFilament / ❓┊help
2y ago
Place date picker filter on table header actions
FilamentFFilament / ❓┊help
7mo ago