F
Filament3w ago
Jon

How can I create a button to toggle a group of fields instead of utilizing the column filters

I have a use case where a table has a lot of columns that span beyond the screen. These columns all need to be present for filtering purposes and quick comparisons between models, but I would like to create tabs that simply toggle them on or off based on the selected value. I am not sure how to accomplish this within filament. Example output without filament: If i have fields ID, Hobby, [field set 1 |2|3|4|5] , actionables. the buttons should only toggle the field set. And only one set of fields should be present at a time, though all can be filtered through the standard process. Are there any "Column groups" that have a taggable option? If i understood how filament works, I could try this myself, but beyond the basic form and table additions, I struggle with knowing how to customize things. But I imagine that the best way to do this would be modify a columnGroup to accept a toggleable button. with a radio or checkbox selection. (one or the other, or all selected)
No description
No description
No description
Solution:
use tabs ListXX.php ```php use Filament\Resources\Components\Tab;...
Jump to solution
3 Replies
Solution
LeandroFerreira
use tabs ListXX.php
use Filament\Resources\Components\Tab;
public function getTabs(): array
{
return [
'tab1' => Tab::make(),
'tab2' => Tab::make(),
];
}
use Filament\Resources\Components\Tab;
public function getTabs(): array
{
return [
'tab1' => Tab::make(),
'tab2' => Tab::make(),
];
}
TextColumn::make('a')
->visible(fn (Pages\ListXX $livewire): bool => $livewire->activeTab === 'tab1'),

TextColumn::make('b')
->visible(fn (Pages\ListXX $livewire): bool => $livewire->activeTab === 'tab2')
TextColumn::make('a')
->visible(fn (Pages\ListXX $livewire): bool => $livewire->activeTab === 'tab1'),

TextColumn::make('b')
->visible(fn (Pages\ListXX $livewire): bool => $livewire->activeTab === 'tab2')
Jon
JonOP3w ago
that worked. Thanks... is there a way to apply the ->visible to the entire group of fields to avoid repeating? as of now, ->visible isnt an available function for groups
LeandroFerreira
yes, only by column
Want results from more Discord servers?
Add your server