F
Filament4mo ago
Asmit

Please help, Record not resolved in visible() method of a SelectColumn

I’m trying to conditionally show a column based on the current record like this:
SelectColumn::make('car_color')
->label('Colors')
->options(CarColors::class)
->sortable()
->visible(function (Car $record) {
dd($record);
}),
SelectColumn::make('car_color')
->label('Colors')
->options(CarColors::class)
->sortable()
->visible(function (Car $record) {
dd($record);
}),
But the dd($record) inside the visible() callback never gets triggered, and it seems like the $record is not being resolved at all. Is visible() supposed to have access to the record for SelectColumn, or is it evaluated globally (i.e., not per record)? Would love some clarification on this. Thanks!
3 Replies
Hasan Tahseen
Hasan Tahseen4mo ago
Try to add ->live if you can. Or use something like this
toeknee
toeknee4mo ago
Options should be configured to us fn() => too.
Hasan Tahseen
Hasan Tahseen4mo ago
Yeah correct. Thanks

Did you find this page helpful?