getHEaderWidgetColumns not works in resource view
In my resource view, i have a stats widget wit 5 boxes divided in 2 rows 3 and 2
i want 5 block in a row, so i added getHeaderWidgetsColumns() to my widget but it doens't works
i want 5 columns only for this widget not for the otherd
``
<?php
namespace App\Filament\Resources\RepairResource\Widgets;
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
use Filament\Widgets\StatsOverviewWidget\Stat;
class RepairOverview extends BaseWidget
{
public function getHeaderWidgetsColumns(): int | array
{
return 5;
}
protected function getStats(): array
{
$quote = 165;
$paid = 175;
$costs = 120;
$profit = $quote - $costs;
$finalProfit = $paid - $costs;
return [
Stat::make('Preventivo', $quote) ,
Stat::make('Incasso', $paid),
Stat::make('Costi', $costs),
Stat::make('Utile previsto', $profit),
Stat::make('Utile effettivo', $finalProfit)
->description('7% decrease'),
];
}
}
```
2 Replies
Looking at the code. I don’t think you can change the columns on a stats overview widget. You might have to make a custom one.
You can use
protected function getColumns(): int
, but it only allows you 4 columns max. If you need more columns you can create your own view based on stats-overview-widget.blade.php
and modify it to add more column options. Mine is: