F
Filament14mo ago
Kuldeep

Add action to the livewire component

I'm using this livewire component: https://filamentphp.com/docs/2.x/tables/getting-started#preparing-your-livewire-component to display the list and wanted to add an Action before the list. I've tried with adding a custom code to the blade before
$this->table
$this->table
but not worked. This will be the same process as the Filament resource but it'll not possible in my case because I'm using a Filament view resource and into that, I've used the livewire component in the Tab section.
Filament
Getting started - Table Builder - Filament
The elegant TALL stack table builder for Laravel artisans.
14 Replies
Dan Harrin
Dan Harrin14mo ago
please clarify: send code, tell us what "not worked" also send a screenshot hinting at what you're trying to do
Kuldeep
Kuldeep14mo ago
My livewire component file is attached. I wanted to add an action button before the list
<div>
<!-- Action button code -->
{{ $this->table }}
</div>
<div>
<!-- Action button code -->
{{ $this->table }}
</div>
But, the Action button to make a new document is not displayed.
Dennis Koch
Dennis Koch14mo ago
You need <x-filament::page> as a wrapper around you table. Check the list-records.blade.php or edit-record.blade.php for reference
Kuldeep
Kuldeep14mo ago
Ok, let me try
Kuldeep
Kuldeep14mo ago
I'm getting this error as of now, the updated code is attached.
Dennis Koch
Dennis Koch14mo ago
Please don't screenshot error messages and share a Flare url as stated in #✅┊rules
Kuldeep
Kuldeep14mo ago
Sorry! Error: Call to a member function getName() on array On line: {{ \Filament\Facades\Filament::renderHook('resource.pages.list-records.table.end') }}
Dennis Koch
Dennis Koch14mo ago
That not a Flare url 🤷🏼‍♂️ Did you read #✅┊rules ?
Kuldeep
Kuldeep14mo ago
Flare
Call to a member function getName() on array - The error occurred at http://localhost:7403/properties/view/11
Dennis Koch
Dennis Koch14mo ago
What does your livewire.document view look like? Ah wait it's in the Flare error Can you remove both Filament::renderHook() calls from your blade view if you don't need them?
Kuldeep
Kuldeep14mo ago
Still getting same error The error is from the mounted Action which I've added in the component to show the action button.
Dennis Koch
Dennis Koch14mo ago
The error is from the mounted Action which I've added in the component to show the action button.
Can you show that code?
Kuldeep
Kuldeep14mo ago
Yeah sure. Method: getMountedAction()
Dennis Koch
Dennis Koch14mo ago
Not sure where you found getMountedAction(). I don’t think we have that in the docs.