0

In Vaadin 8.1, the Grid API doc shows that we can pass a renderer as part of the column definition when calling addColumn. But I do not see any setter methods for changing the renderer.

Is there any way to change the renderer on a column in the Grid object?

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
  • 3
    Do you mean [this method](https://vaadin.com/api/8.1.0/com/vaadin/ui/Grid.Column.html#setRenderer-com.vaadin.ui.renderers.Renderer-)? You can get the column object like `grid.getColumn("yourColumnId")`. – Steffen Harbich Aug 28 '17 at 07:48
  • 1
    @SteffenHarbich As steffen says, you only have to call the setter like `grid.getColumn(columnId).setRenderer(rendererObject);` Where columnId is an `Object`. – Shirkam Aug 28 '17 at 07:57

1 Answers1

1

Column rather than Grid

Call setRenderer on the column rather than the grid.

The column is represented by a class nested inside the grid class, Grid.Column. Pass a column ID to retrieve the particular column.

myGrid.getColumn( someColumnId )

There you call setRenderer.

myGrid.getColumn( someColumnId ).setRenderer( myRenderer ) ;

Replacing the renderer is shown in the Vaadin Framework guide, Grid page, section Column Renderers.

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154