FilamentF
Filament3y ago
Ryan

Table combine multiple values into one column with multiple rows

I know at a minimum I could do a custom view column to make this work. Just curious if I can do it without having to define a view. I want a table column that combines multiple database columns into one and splits it across multiple lines. For example I have the following Database columns:

  • address_1
  • address_2
  • city
  • state
  • zip
  • country
and I want to compose them to one table column showing a properly formatted address like:

Address 1
Address 2
City, State Zip
Country

I was trying to set address_1 as the table column and make the description using the other columns, but I could not figure out a way to make line breaks work in a description.

If I could just define line breaks in a description that'd be perfect. I'd probably end up using that in a few places to be honest.
Solution
You could probably do it with state() or formatStateUsing() and return a string using HtmlString. But honestly, this is exactly what ViewColumns are for.
Was this page helpful?