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) {
{ column.Name } | }|||
---|---|---|---|
No Results | |||
@column.getCell(row) | }