F
Filament6mo ago
Quin.

Show columns based on filters

Hello i had a question about the filters. I made a trashed filter but i only want to show the deleted_at column if the filter Only deleted records is selected is there anyway that is possible?
Solution:
Probably shouldn't be a strict compare, because Livewire often uses strings
Jump to solution
5 Replies
Dennis Koch
Dennis Koch6mo ago
I think you can access the activeFilters property on the component. Something in this direction:
->visible(fn ($livewire) => $livewire->activeFilters ...)
->visible(fn ($livewire) => $livewire->activeFilters ...)
Quin.
Quin.6mo ago
Property [$activeFilters] not found on component: [app.filament.resources.customer-contract-resource.pages.list-customer-contracts]
Tables\Columns\TextColumn::make('deleted_at')->visible(fn ($livewire) => $livewire->activeFilters),
Tables\Columns\TextColumn::make('deleted_at')->visible(fn ($livewire) => $livewire->activeFilters),
is there any documentation about this?
Dennis Koch
Dennis Koch6mo ago
Probably was renamed with v3. Check the available properties of ListRecords page.
Quin.
Quin.6mo ago
Thank you, i will look into it!
$livewire->tableFilters['trashed']['value'] === 0
$livewire->tableFilters['trashed']['value'] === 0
i tried this but this wouldn't work either
Solution
Dennis Koch
Dennis Koch6mo ago
Probably shouldn't be a strict compare, because Livewire often uses strings