Place table Widgets under tabs on custom view page
I want the invoice table to be under the invoice tab .Receipts will have it's table and so on for the tabs.In my code , i created the table as a widget and added it inside getFooterWidgets() just to ensure it displays .the intention is not for the table to be a footer.
16 Replies
@lodeki How did you create the tabs? Is this a custom page?
Yes ....the tabs are the normal tailwind with html.
Ok, makes sense. Your widgets are simple Livewire components so if you have one widget for each table you want, you can display each table inside of its own Tab.
Okay let me try it out then i'll get back .
I think something like this should work:
That one didn't work . I got Unable to find component: [] even after running livewire:discover command .
Make a component for every table you are going to use
Filament
Getting started - Table Builder - Filament
The elegant TALL stack table builder for Laravel artisans.
You can render the livewire component you made for this table in your blade with the tabs
Thank you .Let me try it .
It really worked .Thank you .The only challenge i have is to get the $record so that i can use it in the getTableQuery() method .
Where do you need the record for in the query?
Inside the component, I have the getTableQuery() function that returns a Builder .I want to use the record in this method .
I don't think you are supposed to use record in the Query. Because query is supposed to get all records
Also the record doesn't exist there because you haven't selected 1 record
You could do a Model::where and get all the record data from there
I passed the $record to the component this way * @livewire('invoices-table-component',['record' => $this->record])
* .When i dd($record) inside the mount method of the component i get the record.
Why do you want to get the record?
You get only a table with 1 record in it then?
The invoice table has invoices related to that particular record,that's why i had to use the record to query the invoices related to it.