I am trying to set the sytle of a grid cell dynamically, based on the value of a cell in a row above it ( the grid shows a list of versions of an object and I want to highlight a cell where there is a difference with its previous version value ).
I was looking at setCellStyleGenerator as an option but it is gone in Vaadin 8 …
setStyleGenerator will not work since in the apply method, I don’t have visiblity to the rest of the grid data and cells.
I mean, instead of looking for the previous value from the Grid in setStyleGenerator(), look for it from the DataProvider or however it is that you populate the data in your Grid.
Thanks for the prompt reply - so just to make sure I understand your suggestion, in the StyleGenerator apply method,scan the relevant data in my data provider and set the style accordingly ?
Matic - this is exacatly what I used, only in previous versions of Vaadin, only in earlier version a
setCellStyleGenerator method was avaiable which inluded the cell infromation so one could traverse the grid and get other cells infromation.
Anyway, based on Olli’s direction (Thanks man ! ) I ended up with this code which seems to work fine and is not too ugly
My first guess is to clear the browser history as the css file is cached and won’t change unless you clear the browser cache.
My second guess is that the scss file is either not located correctly or not compiled well.
The documentation in the Vaadin book is not great, I struggled with it also.
I Ended up putting my theme folder under the resources folder ( see my theme (telco) folder structure in the attached pic ) and added a compilation goal in my maven file :
Matic, thank you a lot!
I spend almost a day trying to implement row highlighting.
Your “> td” trick make me happy.
Wonder why this idea is not in the Vaadin book/tutorial?
The problem is Vaadin has applied !important on the v-grid-cell’s css…it overrides row’s css. Wonder why nobody told them its bad practice to use !important.