F
Filament13mo ago
Vp

table column visibility base on record

I am trying to set the table column visibility base on some record, but it's showing error Argument #1 ($record) must be of type App\Models\Candidate, null given What I've tried:
Tables\Columns\TextColumn::make('name')
->visible(fn (Candidate $record): bool => $record->is_complete) // is_complete is boolean column
Tables\Columns\TextColumn::make('name')
->visible(fn (Candidate $record): bool => $record->is_complete) // is_complete is boolean column
But the same function for ->visible() is working fine in actions My code which is working for action:
Tables\Actions\ViewAction::make()
->visible(fn (Candidate $record): bool => $record->is_complete),
Tables\Actions\ViewAction::make()
->visible(fn (Candidate $record): bool => $record->is_complete),
So, what should be the error here?
Solution:
This was asked quite some times here. You cannot hide table columns based on a record, because that would result in a bad table layout.
Jump to solution
3 Replies
Solution
Dennis Koch
Dennis Koch13mo ago
This was asked quite some times here. You cannot hide table columns based on a record, because that would result in a bad table layout.
Vp
VpOP13mo ago
ok, thanks for fast respond.. I'll just set placeholder then.. thank you
hgms
hgms13mo ago
Just thought I'd add a use case that maybe wasn't considered. I'm using the Table builder with a non-traditional table layout and not being able to hide an empty field using the callback record makes my layout wonky.
Want results from more Discord servers?
Add your server