I want to change the text color for rows in my Grid, when a certain flag (archived) is set in the record. For that I followed the documentation in (https://vaadin.com/docs/latest/components/grid#part-name-generator).
My code so far:
private final Grid<JobState> grid = new Grid<>(JobState.class, false);
// add some columns
grid.setPartNameGenerator(jobState -> {
if(jobState.isArchived()) {
return "archive";
}
return null;
});
vaadin-grid.styling::part(archive) {
color: blueviolet;
}
The CSS file is located within an own theme, which as such works (I can change global settings there etc.). A breakpoint within the PartGenerator verifies that it works as expected. Only the selected part never takes any effect on the frontend.
My Vaadin version is 24.3.5.
What am I missing?
OK, I found what I was missing:
grid.addClassName("styling");
This is necessary to include the "styling" class of the css for this grid. I overlooked that in the example.