Create a reusable Table Listing Livewire Component
Hi all,
I'm trying to create a reusable Filament Table using Livewire. I want to have this component 'TableListing' where I will pass it from my controller to a Livewire Component with parameters such as:
- The Form schema
- The Table columns
- The Model to query/update
So far i managed to do all that by calling something like
<livewire:table-listing :model="$jobModel" :columns="$jobColumns" :form="$jobForm" />
The listing works and the actions (on each row) work.
What does not work is the headerActions
where i have this:
The error comes AFTER i click on that header action. The error I get is invoked by the last line about the columns - which mind you it is working during the table listing rendering.
The exact error is:
Filament\Tables\Table::columns(): Argument #1 ($components) must be of type array, null given, called in [...]/laravel-base/app/Livewire/TableListing.php on line 37
So it seems that once the headerAction is clicked, a rerender is causing the $this->columns
to be set to null. Also please keep in mind that I defined these variables as private as it seems passing these as public were not even being rendered :
Any ideas on this ? Thank you!1 Reply
No ideas? π