如何将特定样式添加到GWT DataGrid [英] How to add specific style to GWT DataGrid
问题描述
例如:
<$ p
$ lt; code> table.setRowStyles(new RowStyles< Entry>(){
@Override
public String getStyleNames(Entry entry,int rowIndex){
return entry.isStyle ()?newStyle:null;
}
});
newStyle是全局CSS样式。
问题是风格不适用于行,直到我添加!important
到css定义。
但是!important
我失去了所有默认的DataGrid样式,只有newStyle。
更新: css文件
.newStyle {
color:lightgray;
请参阅此前的问题的工作解决方案。为了方便复制:
简而言之,扩展
DataGrid.Style
(目标是只有一个新的
类型,你不需要添加任何东西),并让你的
dataGridStyle
重写方法返回你自己的子类型
DataGrid.Style
(并且它会因返回类型协变而起作用)
I need add new style for some DataGrid rows, depending on variable.
For example:
table.setRowStyles(new RowStyles<Entry>() {
@Override
public String getStyleNames(Entry entry, int rowIndex) {
return entry.isStyle() ? "newStyle" : null;
}
});
"newStyle" is global css style.
The problem is style not applied to rows until i add !important
to css definition.
But with !important
i lost all default DataGrid styles and have only "newStyle".
UPDATE: css file
.newStyle {
color : lightgray;
}
See this previous question for the working solution. Copied for convenience:
In short extend the
DataGrid.Style
(the goal is only to have a new type, you don't have to add anything to it) and have yourdataGridStyle
overridden method return your own subtype rather thanDataGrid.Style
(and it'll work because of return-type covariance)
这篇关于如何将特定样式添加到GWT DataGrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!