I’m wondering if it’s possible to access Grid item (row) properties from the custom Renderer.
I would like to replace Table with Grid, and I’m investigating if it’s possible to remain the same look and feel.
In my table I have custom Table.ColumnGenerator that generates cells for the column (property) based on the another column’s value for the same item.
To make it clearer, here is the code snippet
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
Item item = source.getItem(itemId);
Object cellValue = item.getItemProperty(columnId).getValue();
boolean flag = (boolean) item.getItemProperty("flag").getValue();
String content = SomeUtils.formatAsHtml(cellValue, flag);
return new Label(content, ContentMode.HTML);
}
So based on the value of the “flag” property I get different HTML that I would like to display in a table cell.
Is it possible with Grid or it’s better to have Table?
Thanks in advance
Alex
What version of Vaadin do you mean?
I’m not able to find method ‘addGeneratedColumn’ in Grid in versions up to 7.7.6
Also in
this article I found the following in the section
Differences to Table : Grid has no generated columns.
May be I’m missing something. Could you please get more detais on your example.
I’m sorry Alex. Because my code is a bit complicated, my extraction was not perfect ;-). Please see my updated unswear (you need to use
GeneratedPropertyContainer, that wraps your original container).