GWT celltable make some columns bold
Question
I am using a GWT CellTable.
I have a requirement where i want to make just a few columns in few of the rows to be bold, depending on the data of that column.
I can't seem to find any clean implementation.
Any pointers would be helpful.
Solution
If the style depends directly on the value of the cell, then you can extend Column
and override getCellStyleNames
.
Otherwise you can use a RowStyles
to apply a CSS class name to the row (depending on the row object), use Column#setCellStyleNames
on the columns where cells have to be bold, and use a descendant selector in your CSS stylesheet to only apply bold style to cells at the cross of the row and column:
.rowWithBoldCells .cellMightBeBold { font-weight: bold; }
(rowWithBoldCells
is only applied to rows where some of the cells have to be bold, and cellMightbeBold
is applied to all cells in a given column).