Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Grid: How to render a cell value based on other columns

Michael Oberwasserlechner
6 years ago Apr 10, 2016 6:53pm
Tatu Lund
6 years ago Apr 12, 2016 8:22am
Burke Ingraffia
6 years ago Apr 12, 2016 4:03pm
Michael Oberwasserlechner
6 years ago Apr 13, 2016 6:40am

@Tatu: Thanks. If I understand correctly, using the client-side approach all my date localization is done on the client side and the server side simply send JsonValues with the relevant information. I will try this asap.
@Burke: Thanks. But setting styles to indicate a certain value and then reading and changing it with jQuery or pure Javascript is a little unusual. Don't get me wrong its a interessting idea but quite a hack ;).

In general I hoped for a easier solution. Because the task at hand seems so common. I digged a bit deeper and found:

RowDataGenerator
In com.vaadin.ui.Grid.RowDataGenerator.writeData(CellReference, JsonObject) I see

Item item = cell.getItem();

which is exactly what I need but the item it is not provided to the renderer. Every Grid and every Custom Renderer (Server) has its own instance so setting the currently processed row item to the AbstractRenderer would be great althought the question ist whether Vaadin is willing to add such change to the framework?

Renderer extends AbstractGridExtension
Another way would be com.vaadin.ui.Grid.AbstractGridExtension.getItemId(String) because every existing (server-side) Renderer extends AbstractGridExtension but while encoding the modelValue I do not have access to the rowKey needed

Thanks again for your answers.

BR,
Michael

Julien Charpenel
6 years ago Apr 13, 2016 9:37am
Teemu Suo-Anttila
6 years ago Apr 13, 2016 10:35am