【发布时间】:2016-06-07 09:52:10
【问题描述】:
我想更改网格的列颜色。不幸的是,什么也没发生……这是我的代码:
grid.setCellStyleGenerator(( Grid.CellReference cellReference ) -> {
if ( "name".equals( cellReference.getPropertyId() ) ) {
return "highlight-green";
} else {
return "rightAligned";
}
});
mytheme.scss:
@import "../valo/valo.scss";
@mixin mytheme {
@include valo;
// Insert your own theme rules here
.rightAligned {
text-align: right;
}
.v-table-row.v-table-row-highlight-green,
.v-table-row-odd.v-table-row-highlight-green {
background-color: #00ff00;
}
}
rightAligned 效果很好,但 highlight-green 不行
【问题讨论】:
-
Firefox 在inspecting CSS 风格问题上做得很好。您可以使用内置的开发人员工具来检查您的样式被覆盖的原因(如果是的话),甚至可以在客户端添加/更改样式以进行测试。
-
v-table-row和v-table-row-odd用于 Vaadin Table,Grid 组件使用其他样式类v-grid-row和v-grid-row-stripe。
标签: css grid themes vaadin vaadin7