Conditional rendering a table column

Is it possible to conditionaly render a column or the value of a column? Lets say I have a form with a boolean field: "send_email" and only when the value is true I want to show the email related fields. This is perfectly possible in a form. But what if I want to do show this also in the table? Can I for example hide the contents of the email fields when send_email is set to true in the table?
4 Replies
JJSanders
JJSandersOP11mo ago
Bumping this question. Anyone???
Dennis Koch
Dennis Koch11mo ago
It is possible to hide columns based on global settings. But not based on single records because that could break the table layout when some rows have more columns than others.
JJSanders
JJSandersOP11mo ago
I get it. Would it be possible to just leave the content of the column blank?
Dennis Koch
Dennis Koch11mo ago
Something like this should work:
->getStateUsing(fn ($record, $state) => $record->send_email ? $state : null)
->getStateUsing(fn ($record, $state) => $record->send_email ? $state : null)
Want results from more Discord servers?
Add your server