Append CSS style to grid row on grid row click

Hi,

i need to append new CSS style to clicked row. I’ve got grid click action listener which gives me ItemClickEvent. I can access Item that was clicked, i have access to containerDataSource but how to get direct row access and add custom style?

RowStyle renderer is being used while grid is filled at start, after clicking I’ve noticed that CellStyle renderer is being trigerred but there is also no row reference.

Hi,

Is your issue related to Vaadin 7 or Vaadin 8? The solution for both is quite the same, but the APIs work a bit differently.

You need to make the Framework know that you want to redraw this one item. In Vaadin 8 we have
grid.getDataProvider().refresh()
for that purpose, in Vaadin 7 you’ll need to make some change to the item to trigger only that one row update. You can also remove and re-set the rowStyleGenerator that will trigger a full reset of all the data.

//Teemu