Should visible & hidden work on Custom Column?

I tried to use visible & hidden in my Custom Column, but it throws an error saying that $record is null.
DatePickerColumn::make('date_delayed_to')
->label('Delayed To')
->visible(fn(Model $record) => $record->status_id == OrderStatus::DELAYED)
DatePickerColumn::make('date_delayed_to')
->label('Delayed To')
->visible(fn(Model $record) => $record->status_id == OrderStatus::DELAYED)
For now I will put the logit in the PHP Component class or the view file directly, but I was hoping to make the column more abstract/reusable.
1 Reply
awcodes
awcodes10h ago
Visible/hidden columns doesn’t work in tables on a per record basis because it would break the table. Columns have to either be in the table or not. I think it would work if you were using Splits, since then it wouldn’t be an actual table markup.

Did you find this page helpful?