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

salioudiabate's avatar

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!

0 likes
1 reply

Please or to participate in this conversation.