F
Filament13mo ago
Arko

$columnSpan on StatOverviewWidget

I'm trying to get 4 stats per row, but changing the $columnSpan doesn't seem to do anything. For example:
class KpiStats extends StatsOverviewWidget
{
protected int | string | array $columnSpan = 1;

protected function getStats(): array
{
return [
Stat::make(__('Stat 1'),'€0,00'),
Stat::make(__('Stat 2'),'€0,00'),
Stat::make(__('Stat 3'),'€0,00'),
Stat::make(__('Stat 4'),'€0,00'),
Stat::make(__('Stat 5'),'€0,00'),
Stat::make(__('Stat 6'),'€0,00'),
Stat::make(__('Stat 7'),'€0,00'),
Stat::make(__('Stat 8'),'€0,00'),
];
}
}
class KpiStats extends StatsOverviewWidget
{
protected int | string | array $columnSpan = 1;

protected function getStats(): array
{
return [
Stat::make(__('Stat 1'),'€0,00'),
Stat::make(__('Stat 2'),'€0,00'),
Stat::make(__('Stat 3'),'€0,00'),
Stat::make(__('Stat 4'),'€0,00'),
Stat::make(__('Stat 5'),'€0,00'),
Stat::make(__('Stat 6'),'€0,00'),
Stat::make(__('Stat 7'),'€0,00'),
Stat::make(__('Stat 8'),'€0,00'),
];
}
}
21 Replies
Dan Harrin
Dan Harrin13mo ago
columnspan is about how wide the entire widget is not how many columns it has are you looking for $columns maybe?
Arko
ArkoOP13mo ago
Doesn't seem to have a $columns property, but this works:
protected function getColumns(): int
{
return 4;
}
protected function getColumns(): int
{
return 4;
}
Thanks
Dan Harrin
Dan Harrin13mo ago
ah ok makes sense cause the number of columns is dynamic in the default implementation check parent::getColumns() if you wanna look
Arko
ArkoOP13mo ago
Is there also a native way to get two charts in 1 row? Will do thanks
Dan Harrin
Dan Harrin13mo ago
yeah? by default? $columnSpan = 1 if your dashboard has 2 cols
Arko
ArkoOP13mo ago
On a custom page I mean, sorry
Dan Harrin
Dan Harrin13mo ago
getHeaderWidgetsColumns() returns 2 so it should put them in 2 cols
Arko
ArkoOP13mo ago
hmm ok gotcha thanks love whats on the agenda today
toeknee
toeknee13mo ago
you
Dan Harrin
Dan Harrin13mo ago
client work, then family visiting this weekend :) hbu
Arko
ArkoOP13mo ago
working at client today, darts match tonight then weekend prepping for my trip to murica next week
Dan Harrin
Dan Harrin13mo ago
enjoy!
toeknee
toeknee13mo ago
Enjoy both of you!
Dan Harrin
Dan Harrin13mo ago
thanks
Arko
ArkoOP13mo ago
what are ur plans (besides me)
toeknee
toeknee13mo ago
I've got the girlfriend round for netflix and chill Followed by a 5k run Lunch 10K walk Some work Then Take the girlfriend out on the motorbike and have a hike up the mountain and a coffee Follow by a nice lunch, then cooking a roast tea for some friends
Arko
ArkoOP13mo ago
that sounds mostly exhausting best of luck brother
toeknee
toeknee13mo ago
ahahaha! It's completely fun and chill to me 😄
Arko
ArkoOP13mo ago
have fun then 😄
toeknee
toeknee13mo ago
Absolutely
Want results from more Discord servers?
Add your server