Renderer in grid column


Someone could help?
How can I add grid’s row to different renderer?

How can I add grid’s row to different renderer?

Renderers are set to Grid by Columns. In Vaadin 8, the Renderer can be set as parameter in addColumn method or
separately, in Grid.getColumn(…).setRenderer(…) method. The latter one works with Vaadin 7 too.

Vaadin 7 examples

Vaadin 8 examples

Hi Tatu, these examples are available in Vaadin 8 Add-ons recommended but they didn’t worked for me:

public SimpleGrid() {
        addColumn(GridItem::getValue0).setCaption("Index 0");
        addColumn(GridItem::getValue1).setCaption("Index 1");
        addColumn(GridItem::getValue2).setCaption("Index 2");
        addColumn(GridItem::getValue3).setCaption("Index 3");
        addColumn(GridItem::getValue4).setCaption("Index 4");
        addColumn(GridItem::getValue5).setCaption("Index 5");

        addColumn(GridItem::getValue6, new CheckboxRenderer<>(GridItem::setValue6))
        .setCaption("Index 6")
        .setEditorComponent(new CheckBox(), GridItem::setValue6).setEditable(true);

Follow the error message:

Uncaught client side exception Given column at index 6 does not exist in Grid

java.lang.IllegalArgumentException: Given column at index 6 does not exist in Grid
at Unknown.nn(Unknown script code)
at Unknown.Pn(Unknown script code)
at Unknown.Wn(Unknown script code)
at Unknown.Ulg(Unknown script code)
at Unknown.kGf(Unknown script code)
at Unknown.lGf(Unknown script code)
at Unknown.p8c(Unknown script code)
at Unknown.kad(Unknown script code)
at Unknown.Cs(Unknown script code)
at script code)
at Unknown.fs(Unknown script code)
at Unknown.jr(Unknown script code)
at script code)
at Unknown.anonymous(Unknown script code)