Access to item in grid converter

Hi, I have a converter for a column that need data of others columns of item for know how do convert value.

How do I get item inside a grid converter?

According to my understanding there is no way to do that in a Converter, since it doesn’t know anything about the Grid. If you need to do something like you describe, you need to do that in a Renderer, since in the RendererConnector you get access to RendererCellReference (it is passed as parameter to render method). Via that object you get access to Grid and can inspect other values in the row.


Finally, I hack the class “RpcDataProviderExtension”:

[font=courier new]
private JsonValue getRowData(Collection columns, Object itemId) {
try {
Item item = container.getItem(itemId);


// ENACCION - CSZ - permite obtener el item
", item);

JsonObject rowData = Json.createObject();

        Grid grid = getGrid();

        for (Column column : columns) {
            Object propertyId = column.getPropertyId();

            Object propertyValue = item.getItemProperty(propertyId).getValue();
            JsonValue encodedValue = encodeValue(propertyValue,
                    column.getRenderer(), column.getConverter(),

            rowData.put(columnKeys.key(propertyId), encodedValue);

        final JsonObject rowObject = Json.createObject();
        rowObject.put(GridState.JSONKEY_DATA, rowData);
        rowObject.put(GridState.JSONKEY_ROWKEY, keyMapper.getKey(itemId));

        if (visibleDetails.contains(itemId)) {
            // Double check to be sure details component exists.
            Component detailsComponent = detailComponentManager.visibleDetailsComponents
                    (detailsComponent != null ? detailsComponent
                            .getConnectorId() : ""));


        CellStyleGenerator cellStyleGenerator = grid.getCellStyleGenerator();
        if (cellStyleGenerator != null) {
            setGeneratedCellStyles(cellStyleGenerator, rowObject, columns);
        RowStyleGenerator rowStyleGenerator = grid.getRowStyleGenerator();
        if (rowStyleGenerator != null) {
            setGeneratedRowStyles(rowStyleGenerator, rowObject);

        return rowObject;

    } finally {

", null);

And now I can get Row Reference in this way on Renderer:

[font=courier new]
public JsonValue encode(String value) {

BackedItem item = (BackedItem) (VaadinSession.getCurrent().getAttribute(“GridRowData[”+Thread.currentThread().getId()+"]

            SelectRender.this.fieldHelper.setCurrentRow((Row) item.getObject());
            String decodeValue = SelectRender.this.fieldHelper.getDecodedValue(value);

            //System.out.println("SelectRender item["+item+"]


            return super.encode(decodeValue);


This has the disadvantage of having to be very careful with the Update of Vaadin.