-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
Here's how I setup my column headers:
// setup column data
for idx, header := range data.headers {
columns[idx] = table.NewFlexColumn(strings.ToLower(header),
header, lengths[idx]).WithFiltered(true).WithStyle(Highlighted)
}
filtertbl := FilterTable{
maxColumns: len(data.headers),
Rows: len(data.entries),
headerIdx: hidx,
ctx: ctx,
columns: columns,
}
filtertbl.Table = table.New(columns)The problem is, that the style Highlighted is then applied to all cells of the table, not just the header fields.
I understand the idea to apply a style to a whole column, but sometimes you want to have a somewhat highlighted table header. Is that possible somehow?
I'd expect something like this to style invidual header fields:
for idx, header := range data.headers {
columns[idx] = table.NewFlexColumn(
table.NewStyledCell(strings.ToLower(header), StyleHeader),
header, lengths[idx]).WithFiltered(true).WithStyle(NoStyle)
}But even if this would work, it would just apply a style to the header field text. What if I want to have the whole cell including the borders to have another background color than the remainder of the table?
best,
Tom
edited to add:
What I CAN do is to add a style to the header string directly, like this:
for idx, header := range data.headers {
columns[idx] = table.NewFlexColumn(strings.ToLower(header), StyleHeader.Render(header),
lengths[idx]).WithFiltered(true).WithStyle(NoStyle)
}But as I said above, this applies to the header text only:

Metadata
Metadata
Assignees
Labels
No labels