package components type TableCellFormatter[T any] func(data T) templ.Component type TableColumn[T any] struct { Name string // Column Name Getter func(T) string // Data Getter Formatter TableCellFormatter[T] // Data Formatter } templ (c *TableColumn[T]) getCell(d T) { if c.Formatter != nil { @c.Formatter(d) } else if c.Getter != nil { { c.Getter(d) } } else { "Unknown" } } templ Table[T any](columns []TableColumn[T], rows []T) { for _, column := range columns { } if len(rows) == 0 { } for _, row := range rows { for _, column := range columns { } }
{ column.Name }
No Results
@column.getCell(row)
}