#Actions in table column view not triggering

13 messages · Page 1 of 1 (latest)

rose gull
#

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')

In the ManageRelatedRecords page I have my action

 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>

I've spent a while debugging this but I'm at a loss as to why it's not working. Any help appreciated

Cheers

alpine zephyrBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

mortal forge
#

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'));
}
rose gull
#

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

rose gull
#

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

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 ...

scarlet crypt
rose gull
#

Well. It only blummin works! 🥳

How bizzare - do you happen to know why that would make a difference?

scarlet crypt
#

So it expects the names to match exactly : doSomethingCoolAction-> doSomethingCool

rose gull
#

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 🙂