I'm new in vaadin development and i hope someone can help me. I just created a grid table with a model and everything works fine. But now, i want to change the background color of the selected row. I figure out, that i have to create a theme. I found this in the Vaadin Forum: https://vaadin.com/forum/thread/17867059/how-to-set-selected-row-opacity-in-vaadin-grid
This is what i have already done:
- I created a html class with the code from the link. I called this class grid-selection-theme.html
- I put this class into src/main/webapp/frontend/styles/grid-selection-theme.html
- In the java file with the Grid, i added the import: @HtmlImport("frontend://styles/grid-selection-theme.html);
- I added the theme to the grid: mygrid.addThemeName("grid-selection-theme");
Here is the code from the other thread in the forum:
<dom-module id="grid-header" theme-for="vaadin-grid">
<template>
<style>
:host(:not([reordering])) [part~="row"][selected] [part~="body-cell"]:not([part~="details-cell"]) {
background-color: rgba(255, 0, 0, .50);
}
</style>
</template>
</dom-module>
But it does not work.