简体   繁体   中英

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:

@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

Try to add background-color: #00ff00 !important;

It looks like you need to rewrite existing styles of your framework, !important must help with this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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