【发布时间】:2011-09-12 21:15:59
【问题描述】:
我正在努力设计我的 GWT 2.4 DataGrid 的样式,并且每时每刻都遇到障碍。我在 DataGrid 中添加了以下行样式:
dataTable.setRowStyles(new RowStyles<IntegrityItem>() {
@Override
public String getStyleNames(IntegrityItem row, int rowIndex) {
if (row.getSomeValue() >= 100) {
return MyResources.INSTANCE.mystyles().alertRow();
} else {
return "";
}
}
});
alertRow 的样式很简单:
.alertEntry {
font-weight: bold;
color: #00ff00;
background-color: #ff0000;
}
更多信息:我制作了 DataGrid.css 的本地副本,并从所有样式中删除了所有“背景”元素,并使用它来构造 ClientBundle:
public interface MyDataGridResources extends DataGrid.Resources {
public static final FmeaDataGridResources INSTANCE = GWT.create(MyDataGridResources.class);
@Override
@Source({"../resources/styling/mydatagridstyles.css"})
Style dataGridStyle();
}
我在我的 DataGrid 构造函数中使用了这个 (MyDataGridResources.INSTANCE)。
当我试用它时,符合条件的行包含绿色 (#00ff00) 文本,但背景颜色保持为白色或灰色,具体取决于它是偶数行还是奇数行。背景颜色是如何被忽略的?它首先从哪里获得这些颜色?我已经从 css 文件中完全删除了背景颜色信息。
【问题讨论】: