Using Table + Tabs in custom Livewire component
Is it possible to use tabs like the ones in the demo (https://github.com/filamentphp/demo/blob/main/app/Filament/Resources/Shop/OrderResource/Pages/ListOrders.php#L28) to get a similar result when using a table in a custom Livewire component?
GitHub
demo/app/Filament/Resources/Shop/OrderResource/Pages/ListOrders.php...
Source code for the demo.filamentphp.com website. Contribute to filamentphp/demo development by creating an account on GitHub.
8 Replies
#kenneth-sese-advanced-tables
The "Tabs" feature is located within the Form Builder, "Listing" is found in the Table Builder and "Viewing" is in Infolist. To integrate these builders, you'll need to create a custom Livewire component and implement the HasTable and custom infolist (where you put your listing).
Can anyone explain more, please?
I referenced my message in #👹┊off-topic just because I mentioned the answer to this there, not for you to ask in off-topic channel. But I will say again what I said in the message here for people in the future.
Yes you can create tabs for Tables like you would in a Resource. You would have to implement a custom solution using the Tabs blade component https://filamentphp.com/docs/3.x/support/blade-components/tabs. There isn't the same type of support as there is for a
ListRecords
page, but it is definitely doable and it is pretty easy in my opinion. I have a few examples of doing this in my open-source application https://github.com/andrewdwallo/erpsaas. Specifically, you can look at this page as an example: https://github.com/andrewdwallo/erpsaas/blob/4068df7494b7b9ea4c597f0f5ab67996e58a0b01/app/Filament/Company/Pages/Accounting/AccountChart.php. Even though it is a Filament page, it is still a Livewire component and the implementation would pretty much be the same. There are other examples in the repository as well such as the LiveCurrency
page and its associated Livewire components.Thank You @Andrew Wallo. I implement Something Like this.
Is there a better way ? Appriciate if you review this code for me ? @Andrew Wallo
I mean if it works how you want it to, then no, not necessarily. Other than that, it is generally recommended to declare each property on its own separate line, but that isn't really relevant here because I don't think that is what you are asking..