Call Component function from Action button

is it possible to have an Action that when clicked calls a method on the component passing in the row's record (or just id of that row's record)? I cant find an example and currently when i click it reloads the whole page.

context...

I have a seperate audio-player component that I want to pass a new src route to based on the row record.

I have a working Table component to which i want to add an action that changes a public variable (on that tabel component) something like:

...
$parent = $this;
... 

Action::make('play')->icon('heroicon-o-play')->action(fn (Media $record) => $parent->setSrc($record)),
...


fyi: earlier in the code i define $parent

public function table(TableComponent $table): TableComponent
    {
        $parent = $this;
...

the issue i have is that clicking the play button triggers a reload of the page, so even though i set the public livewire component variable $src it reloads and gets set back to '#' .

thanks.

Paul.
Was this page helpful?