0

is anyone have idea ,how to add specific style to GWT Datagrid? I need to add style to specific row ( class="error") to show that row in red color. More details:

Rendering the table using the GWT Datagrid. it has column called "type" . the type can have different values like " connected" ,"disconnected" ,"error". if the type is error then i need to render row with different style( need to show text in the red color).

1 Answers1

5

There's RowStyles for that exact purpose.

grid.setRowStyles(new RowStyles<Row>() {
  @Override
  public String getStyleNames(Row row, int rowIndex) {
    return "error".equals(row.getType()) ? "error" : "";
  }
});
Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164