How to calculate the total of all filtered rows, not just the current page rows in footer() with Rappasoft laravel-livewire-tables
Package : Rappasoft laravel-livewire-tables
Hi,
I'm using the footer() method on a column to display the sum of a numeric field (e.g., amount). I noticed that the $rows parameter passed to the footer callback only contains the rows visible on the current paginated page.
Example:
Column::make('Amount')
->footer(fn($rows) => 'Subtotal: ' . $rows->sum('amount'))
This works fine, but only shows the subtotal for the current page. What I actually need is the total amount for all rows that match the current filters and search, even if they are not currently visible due to pagination.
Is there a recommended way to achieve this from within the footer() method, or should I compute it manually and expose the result via a property in the Livewire component?
Thanks in advance!
Please or to participate in this conversation.