© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
10 replies
paul_89142

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
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)),
...
...
$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;
...
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
$src
it reloads and gets set back to '#' .

thanks.

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

Action call from livewire function
FilamentFFilament / ❓┊help
3y ago
Action to Button component
FilamentFFilament / ❓┊help
3y ago
Call async JavaScript function from a Action
FilamentFFilament / ❓┊help
2y ago
call component from another component
FilamentFFilament / ❓┊help
2y ago