F
Filament9mo ago
KEANUH

Two widgets differents in the same row

I know there is an identical question but it was not answered, I understand that a widget takes the entire row, but my question is how do I place both widgets in the same row? what I have done is this: 1)protected static ?int $sort = 1; 2) protected int | string | array $columnSpan= 2; 1 helps me order but it still doesn't solve the problem
5 Replies
toeknee
toeknee9mo ago
Widgets should take 1 columns of a row. If you have columnSpan = 2 that will take the entire row. Change to columnSpan = 1 should take halve. By default the rows are in a grid of 2
KEANUH
KEANUHOP9mo ago
@toeknee thanks but i would like that both widget has: for example
protected static ?int $sort = 2; protected int | string | array $columnSpan= 3; so that both occupy half.... with only one works but my widget is so small and breaks the design
KEANUH
KEANUHOP9mo ago
that is perfect : but i need to do this in the same widget: return [ Stat::make('Número de servicios', $this->numService) ->descriptionIcon('heroicon-m-calendar-days', IconPosition::Before) ->description('En la fecha '.$this->dateService) ->color('primary'), Stat::make('Número de servicios', $this->numService) ->descriptionIcon('heroicon-m-calendar-days', IconPosition::Before) ->description('En la fecha '.$this->dateService) ->color('primary') ]; that is the problem i would like to use differents widgets
No description
vrij
vrij9mo ago
Hi, I'm not an expert but i've done this before by creating seperate classes for each stat and then creating a stat class where i load in multiple statclasses like this:
protected function getStats(): array
{
return array_merge([], ...array_map(fn($statInstance) => $statInstance->getStats(), $this->statsInstances));
}
protected function getStats(): array
{
return array_merge([], ...array_map(fn($statInstance) => $statInstance->getStats(), $this->statsInstances));
}
KEANUH
KEANUHOP9mo ago
Thanks vrij
In the end I decided to put everything in a single widget, it is the best way but there must be an official way to do that anyway Maybe with : protected function getColumns(): int or public function getHeaderWidgetsColumns(): int | string | array { return 2; }
Want results from more Discord servers?
Add your server