Actions in table column view not triggering

Hi, TLDR; Action in table ViewColumn doesn't do anything when clicked I've got a ManageRelatedRecords page - lets call it "Activity". On my activity page I have a table that displays rows of items that can be of different types. One of the columns is a ViewColumn and depending on the type, it shows different content in the view. In that view, I have an action to view more info. I've followed the docs here: https://filamentphp.com/docs/3.x/actions/adding-an-action-to-a-livewire-component#adding-the-action and my action appears on screen, but when I click it, nothing happens. In my table:
ViewColumn::make('description')->view('filament.tables.columns.activity-details')
ViewColumn::make('description')->view('filament.tables.columns.activity-details')
In the ManageRelatedRecords page I have my action
public function viewMoreDetailsAction(): Action
{
return Action::make('view_more_details')->action(fn() => info('Bob'));
}
public function viewMoreDetailsAction(): Action
{
return Action::make('view_more_details')->action(fn() => info('Bob'));
}
In my activity-details view I have
<div class="mt-4">
{{ $this->viewMoreDetailsAction }}
<x-filament-actions::modals />
</div>
<div class="mt-4">
{{ $this->viewMoreDetailsAction }}
<x-filament-actions::modals />
</div>
I've spent a while debugging this but I'm at a loss as to why it's not working. Any help appreciated Cheers
Solution:
This might be stupid, but can you rename your action to Action::make('viewMoreDetails') ?
Jump to solution
7 Replies
toeknee
toeknee4d ago
What are you trying to get it to do? if for example you do:
public function viewMoreDetailsAction(): Action
{
return Action::make('view_more_details')->form([
TextInput::make('test')
])->action(fn() => info('Bob'));
}
public function viewMoreDetailsAction(): Action
{
return Action::make('view_more_details')->form([
TextInput::make('test')
])->action(fn() => info('Bob'));
}
Adam Holmes
Adam Holmes4d ago
I want it to open a modal that has another view - I was doing info() to see if it run Even with the form, it does nothing It seems 2 requests are fired in the network tab - one for mountAction and another for close-modal Which suggests it's closing the modal straight away rather than opening it
Adam Holmes
Adam Holmes4d ago
I wonder whether this has anything to do with it - I'm rendering an action outside a table, but displaying tables on the page. I am including the modals element though: https://github.com/filamentphp/filament/issues/11678
GitHub
Action Modal Would not open · Issue #11678 · filamentphp/filament
Package filament/filament Package Version v3.2.43 Laravel Version v10.46.0 Livewire Version v3.4.6 PHP Version PHP 8.3.3 Problem description Action that suppose to show a modal for user to fill up ...
Solution
ChesterS
ChesterS4d ago
This might be stupid, but can you rename your action to Action::make('viewMoreDetails') ?
Adam Holmes
Adam Holmes2d ago
Well. It only blummin works! 🥳 How bizzare - do you happen to know why that would make a difference?
ChesterS
ChesterS2d ago
I believe it's just the naming convention. It doesn't convert from camel case -> pascal etc So it expects the names to match exactly : doSomethingCoolAction-> doSomethingCool
Adam Holmes
Adam Holmes2d ago
Fair enough - I guess I've just overlooked that and never needed to use actions this way. All of my actions are snake case so do_something_cool. I guess it wasn't clear from the docs as they're all 1 word actions like delete / edit etc Thanks for the help 🙂
Want results from more Discord servers?
Add your server