Filament table sorting Bug
#❓┊help My filament page table is not sorting the total column correctly , iam using this
Tables\Columns\TextColumn::make('products_total')
->label('Total')
->money('usd', 100)
->getStateUsing(function (Website $record) {
return $record->totalBudget();
})
->sortable(),
I attached the outcome
9 Replies
What are the values in
products_total
column? And what does $record->totalBudget()
do?this was $record->totalBudget() function
So I assume you don't have a
products_total
column. Then you cannot sum it because the calculation relies on the database. You could write your own summarizerhow can i do that
Test what? What columns you have? Look into you database
i have products_total column in db but when creating table iam fetching it relatime from another third party api
So your
products_total
is empty? 🤔 If you fetch it real time, you cannot sort based on itGot it thanks
Can you tell a workaround for that
Calculate your total before and store it in the db