简体   繁体   English

GWT DataGrid特定的行需要添加样式

[英]GWT DataGrid specific row needs add style

is anyone have idea ,how to add specific style to GWT Datagrid? 有谁知道,如何为GWT Datagrid添加特定样式? I need to add style to specific row ( class="error") to show that row in red color. 我需要为特定的行(class =“ error”)添加样式,以将该行显示为红色。 More details: 更多细节:

Rendering the table using the GWT Datagrid. 使用GWT Datagrid渲染表。 it has column called "type" . 它具有称为“类型”的列。 the type can have different values like " connected" ,"disconnected" ,"error". 该类型可以具有不同的值,例如“ 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). 如果类型错误,那么我需要渲染具有不同样式的行(需要以红色显示文本)。

There's RowStyles for that exact purpose. 确实有RowStyles

grid.setRowStyles(new RowStyles<Row>() {
  @Override
  public String getStyleNames(Row row, int rowIndex) {
    return "error".equals(row.getType()) ? "error" : "";
  }
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM