Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

oliverbusk's avatar

FilamentPHP - Table actions not firing

I have a table function in a custom Filament page:

I have initialized the page like this:

class IncentiveOverview extends Page implements HasTable, HasForms, HasActions
{
    use InteractsWithTable;
    use InteractsWithForms;
    use InteractsWithActions;
    use HasTabs;
    
    //...

And my table like below:

public function table(Table $table): Table
    {
        return $table
        ->query(function (): Builder {
                return $this->getIncentiveRequests()->groupBy(['branch_id', 'department_id']);
            })
            ->modifyQueryUsing($this->modifyQueryWithActiveTab(...))
            ->columns([
                TextColumn::make('department.name')
                    ->label('Department')
                    ->sortable(),
                TextColumn::make('gp')
                    ->label('GP')
                    ->money('eur', true)
                    ->state(function ($record) {
                        return $this->calculateGP($record);
                    })
                    ->sortable(),
            ])
            ->actions([
                Action::make('view_incentive_details')
                    ->label('View Incentive Details')
                    ->action(function ($record) {
                        dd($record);
                    })
                ]);
    }

Then, the blade view is looking like this:

<x-filament::page>
    <div class="flex flex-col gap-4">
        <x-filament-panels::resources.tabs />
        <div class="relative">
            {{ $this->table }}
        </div>
         <x-filament-actions::modals />
    </div>
</x-filament::page>

When I try to trigger the view_incentive_details, I would for now, expect that it would just dd the $record, however, when I click it, a spinner is just shown briefly:

image

0 likes
3 replies
LaryAI's avatar
Level 58

It looks like the issue might be related to how the table actions are being handled or rendered. Here are a few steps to troubleshoot and potentially resolve the issue:

  1. Ensure the Action is Registered Correctly: Make sure that the action is properly registered and that the dd($record) is correctly placed within the action's closure.

  2. Check for JavaScript Errors: Open your browser's developer console and check for any JavaScript errors that might be preventing the action from completing.

  3. Ensure the Blade Component is Correct: Verify that the Blade component is correctly rendering the table and actions. Specifically, ensure that the {{ $this->table }} directive is correctly placed.

  4. Update Filament and Dependencies: Ensure that you are using the latest version of Filament and its dependencies. Sometimes, bugs are fixed in newer releases.

  5. Debugging the Action: Add some logging or debugging statements to see if the action is being triggered correctly.

Here is a refined version of your code with some additional debugging steps:

PHP Code (IncentiveOverview.php)

class IncentiveOverview extends Page implements HasTable, HasForms, HasActions
{
    use InteractsWithTable;
    use InteractsWithForms;
    use InteractsWithActions;
    use HasTabs;

    public function table(Table $table): Table
    {
        return $table
            ->query(function (): Builder {
                return $this->getIncentiveRequests()->groupBy(['branch_id', 'department_id']);
            })
            ->modifyQueryUsing($this->modifyQueryWithActiveTab(...))
            ->columns([
                TextColumn::make('department.name')
                    ->label('Department')
                    ->sortable(),
                TextColumn::make('gp')
                    ->label('GP')
                    ->money('eur', true)
                    ->state(function ($record) {
                        return $this->calculateGP($record);
                    })
                    ->sortable(),
            ])
            ->actions([
                Action::make('view_incentive_details')
                    ->label('View Incentive Details')
                    ->action(function ($record) {
                        // Add logging to see if this part is reached
                        \Log::info('Action triggered for record: ', ['record' => $record]);
                        dd($record);
                    })
            ]);
    }
}

Blade View (incentive-overview.blade.php)

<x-filament::page>
    <div class="flex flex-col gap-4">
        <x-filament-panels::resources.tabs />
        <div class="relative">
            {{ $this->table }}
        </div>
        <x-filament-actions::modals />
    </div>
</x-filament::page>

Additional Steps:

  1. Check the Network Tab: Open the browser's developer tools, go to the Network tab, and see if there are any failed requests when you click the action. This can give you more insight into what might be going wrong.

  2. Clear Cache: Sometimes, caching issues can cause unexpected behavior. Clear your application cache using:

    php artisan cache:clear
    php artisan view:clear
    php artisan route:clear
    
  3. Ensure Livewire is Working: Filament uses Livewire under the hood. Ensure that Livewire is properly set up and working in your application.

By following these steps, you should be able to identify and resolve the issue with the table actions not firing in your FilamentPHP setup.

Please or to participate in this conversation.