Setting column color in Vaadin 7

Viewed 32

I have a Vaadin 7 Grid and I would like to set a color to a specific column.

Grid grid = new Grid(container);
grid.setColumnOrder("column1","column 2","column 3");
2 Answers

This piece of code actually worked for me.I have been using Java 8 ,

Grid.setCellStyleGenerator((Grid.CellStyleGenerator) cellReference ->{
 cellReference.getGrid().getHeaderRow(rowIndex: 0).getCell("column name").setStyleName("bg-blue");
}

Note :- bg-blue is the css rule mentioned in CSS file .

Related