Doubts with summarize(Count)
I want to put 3 summarize columns in a table with only two columns. How do I do it? I tried to create two empty columns in the table, but only 2 summarize fields appear. My code:
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->label('Nombre')
->searchable(),
Tables\Columns\TextColumn::make('type')
->label('Tipo')
->summarize(
Count::make('uno')->label('Nº total de clientes')->query(fn ($query) => $query),
)
->sortable()
->searchable(),
TextColumn::make('')
->label('')
->summarize(
Count::make()->label('Nº total de ayuntamientos')->query(fn ($query) => $query->where('type', 0)),
),
TextColumn::make('')
->label('')
->summarize(
Count::make()->label('Nº total de NO ayuntamientos')->query(fn ($query) => $query->where('type', 1)),
)
])->paginated([25, 35, 50, 100])->defaultSort('name', 'ASC')
Solution:Jump to solution
Ok, thank you guys. But in the end, I'm leaving it as it is, the client hasn't bothered.
13 Replies
Don't show me the 3 columns, only two. Image
I have achieved it by putting a name in make(), but there is a very large empty space, and the client does not want that. Is there a way to put two counts() in the same column?
Does anyone know any solution?
nobody?
Did you try adding a widget to the header?
You should give your text columns a unique name. An empty string is no good idea.
ok, thank you. But I have put it because they are "ghost" columns, no name has to appear
It doesn't work for me if I put the 'counts' all together, and yes, I read
No, because it will depend on the filters.
Then set an empty label. They still need a name
It's already done like that, even though it's not in the post. But that's not my problem. I don't want the space from the two 'ghost' columns to show up in the table. I would need another option. Thanks anyway.
This space
Then It’s not a table layout anymore. I doubt we have a solution for that
Maybe you can put 3 summarizers in the first column.
Or create some widgets something like this
Example code can be found here : https://github.com/timwassenburg/filament-timesheets?tab=readme-ov-file
GitHub
GitHub - timwassenburg/filament-timesheets: Laravel Timesheets for ...
Laravel Timesheets for Filament. Contribute to timwassenburg/filament-timesheets development by creating an account on GitHub.
Solution
Ok, thank you guys. But in the end, I'm leaving it as it is, the client hasn't bothered.