How do we get getTableContentFooter() to work with calculated fields?
I followed the trick for Aggregate Data in Table Footer https://filamentphp.com/tricks/aggregate-data-in-table-footer and it worked nicely to sum a field.
But it does not recognize the calculated field.
I tried it with the ID field and it works to sum the ids in the footer (Just a test you know.)
When I made a calculated field from
it returns the id on each line but it will not sum in the footer rather displays a 0.
My real data is minutes in a schedule but the ID example is easy to follow...
But it does not recognize the calculated field.
I tried it with the ID field and it works to sum the ids in the footer (Just a test you know.)
When I made a calculated field from
id with TextColumn::make('id_test') ->getStateUsing(function(Schedule $record) {
return $record->id;
}),it returns the id on each line but it will not sum in the footer rather displays a 0.
My real data is minutes in a schedule but the ID example is easy to follow...
Filament
Filament is a collection of tools for rapidly building beautiful TALL stack apps, designed for humans.
Solution
I think I'll start with the footer, the two values are strings of time that I need to carbon->diffInMinutes resulting in minutes to be summed then formatted as HH:MM