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
No description
9 Replies
Dennis Koch
Dennis Koch11mo ago
What are the values in products_total column? And what does $record->totalBudget() do?
BhupendraKumar
BhupendraKumarOP11mo ago
this was $record->totalBudget() function
No description
Dennis Koch
Dennis Koch11mo ago
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 summarizer
BhupendraKumar
BhupendraKumarOP11mo ago
how can i do that
Dennis Koch
Dennis Koch11mo ago
Test what? What columns you have? Look into you database
BhupendraKumar
BhupendraKumarOP11mo ago
i have products_total column in db but when creating table iam fetching it relatime from another third party api
Dennis Koch
Dennis Koch11mo ago
So your products_total is empty? 🤔 If you fetch it real time, you cannot sort based on it
BhupendraKumar
BhupendraKumarOP11mo ago
Got it thanks Can you tell a workaround for that
Dennis Koch
Dennis Koch11mo ago
Calculate your total before and store it in the db
Want results from more Discord servers?
Add your server