Change color of row with condition

Hi!
I wanna change the color of row table when I have certain column value. For example if my column value is TRUE I want the color row entire RED to show this record cant be used.
How can I do that ! ?

I am newbie with vaadin and there is so confuse but I am working hard with this and it is exicting.

TIA

Hello,

You can do that wit a custom getStyle function.
Here is a sample code.

table.setCellStyleGenerator(new CellStyleGenerator() {
                @Override
                public String getStyle(CustomTable table, Object itemId, Object propertyId) {
                  if (propertyId == null) {
                    // Styling for row
                    Item item = table.getItem(itemId);
           
                    Date dueDate = (Date) item.getItemProperty("dateDue").getValue();
                       
                    if (dueDate == null || dueDate.before(new Date()))
                        return "highlight-red";
                    else
                        return "highlight-bold";
                  
                  } else {
                    // styling for column propertyId
                    return null;
                  }
                }
              });

Then in SCSS you can add “highlight-red” directive :

.v-table-row.v-table-row-highlight-red,
.v-table-row-odd.v-table-row-highlight-red {
  background-color: #ff0000;
  color: white;
}

Regards