简体   繁体   English

Vaadin,改变网格列颜色

[英]Vaadin, change grid column color

I want to change the column color of my grid. 我想更改网格的列颜色。 Unfortunately nothing happens... here is my code: 不幸的是没有发生......这是我的代码:

grid.setCellStyleGenerator(( Grid.CellReference cellReference ) -> {
            if ( "name".equals( cellReference.getPropertyId() ) ) {
                return "highlight-green";
            } else {
                return "rightAligned";
            } 
        });

mytheme.scss: 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;
  }
}

The rightAligned works great, but highlight-green doesn't rightAligned工作得很好,但是highlight-green却没有

Try to add background-color: #00ff00 !important; 尝试添加background-color: #00ff00 !important;

It looks like you need to rewrite existing styles of your framework, !important must help with this. 看起来你需要重写框架的现有样式, !important必须帮助解决这个问题。

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

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