SUMMARIZER USING CUSTOM DATA

I have a table with a personal data source based on an array. One of the columns is numeric, and when I implement a summarizer, it only calculates the records on the page for the grand total. Any guidance? My summarizer code: protected function getSolicitadoSummarizer(): Summarizer { return Summarizer::make() ->label('Total Solicitado') ->using(function (Component $livewire): float { return $livewire->getTableRecords()->sum('CantidadSolicitada'); }); }
2 Replies
Will Aguilar
Will Aguilar2w ago
Maybe this is wrong:
->using(function (Component $livewire): float {
return $livewire->getTableRecords()->sum('CantidadSolicitada');
});
->using(function (Component $livewire): float {
return $livewire->getTableRecords()->sum('CantidadSolicitada');
});
it should be:
->using(function (self $livewire): float {
return $livewire->getTableRecords()->sum('CantidadSolicitada');
});
->using(function (self $livewire): float {
return $livewire->getTableRecords()->sum('CantidadSolicitada');
});
use self not Component in function (self $livewire):
Marcel
MarcelOP2w ago
Thanks for taking the time to reply, Will, but the problem remains: the total per page and the grand total show the same value on each page.

Did you find this page helpful?