F
Filamentβ€’5w ago
Troner

->hidden() on TextColumn not working with $record parameter

I am just trying to pass the $record variable to the ->hidden() method on my TextColumn (for my table in EntryResource.php) like the code below but it returns null.
TextColumn::make('is_public')
->hidden(fn ($record) => dd($record)), // returns null
TextColumn::make('is_public')
->hidden(fn ($record) => dd($record)), // returns null
then I tried using ->formatStateUsing() with $record for testing purpose and it is returning the record.
TextColumn::make('is_public')
->formatStateUsing(fn ($record) => dd($record)), // return the record
TextColumn::make('is_public')
->formatStateUsing(fn ($record) => dd($record)), // return the record
Why I can use $record on ->formatStateUsing() but not on ->hidden()? (Filament v3.2.86)
4 Replies
Dennis Koch
Dennis Kochβ€’5w ago
If you'd search this Discord, you will find an answer. It doesn't make sense, because it would break the table structure if you hide columns on certain rows but not on others
Troner
Tronerβ€’5w ago
Ok, thank you πŸ‘
Dennis Koch
Dennis Kochβ€’5w ago
You probably just want to return an empty string from ->formatStateUsing()
Troner
Tronerβ€’5w ago
Hmm, I want a ToggleColumn where you can toggle "is_public" but only on some records