No matter what I try, I get the default light grey for my odd grid rows. Here’s some snippets for context:
Style sheet (./styles/styles.css):
…
.my-grid .v-grid-row:nth-child(even) {
background-color: #55f955;
}
…
My View: @CssImport(“./styles/styles.css”)
public class JobApplicationsView extends VerticalLayout {
…
// Setup grid for striping
grid.addThemeVariants(GridVariant.LUMO_ROW_STRIPES);
grid.addClassName(“my-grid”);
I’ve tried other things, but alas, nothing changes the stripe colors.
Based on the code sample, looks V24-ish, but the CSS looks like it was written for V8, so I’m guessing it’s a V8 application that’s been migrated to V24ish?
I used IntelliJ’s AI Assistant and came up with that solution. I believe I googled and found a similar solution. I’ve been using IntelliJ’s AI Assistant with great success when it comes to writing a v24 Vaadin app. So much nicer than writing something from scratch.
Right, that’s what I expected. The problem is that AI tools often come up with solutions for much older Vaadin versions (because there’s plenty of material about them still online), in this case Vaadin 8 from 2017. And you’ll sometimes encounter the same outdated info when googling. In Vaadin docs there’s a banner at the top notifying you that you’re looking at docs for an older version, but of course there’s always stackoverflow etc where that may not be obvious.
But at least now you know there’s a styling reference for each component