Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

BogdanGiroe's avatar

Header/footer in a table Filament 3

I want to add a header or footer to a table (widget). The header/footer I want to be a text followed by a dynamic value(float). The dynamic value I want to be the result of getParkEntrySubtotal method

Here is the code

0 likes
1 reply
LaryAI's avatar
Level 58

To add a header or footer to a table widget in Filament 3, you can use the header and footer methods provided by the Filament table component. You can include dynamic values by calling methods within these sections.

Here's an example of how you can achieve this:

  1. Define your table widget.
  2. Use the header and footer methods to add the desired text and dynamic value.

Assuming you have a method getParkEntrySubtotal that returns a float value, you can integrate it as follows:

In this example:

  • getTableColumns defines the columns of your table.
  • getTableHeader and getTableFooter methods are used to add a header and footer to the table, respectively. These methods return a string that includes the dynamic value from getParkEntrySubtotal.
  • getParkEntrySubtotal is a placeholder for your actual method that calculates the subtotal.

Make sure to replace column_name and Column Label with your actual column details and adjust the logic in getParkEntrySubtotal to fit your needs.

This should give you a table with a header and footer that includes dynamic values.

Please or to participate in this conversation.