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.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Vaadin 8 - Grid / Missing Converter
Hi,
i look forward to set a converter on a grid column in Vaadin 8. The purpose is, that i have a status column (model value is of type boolean) which should be represented with an icon and the column should be sortable.
On the previus Vaadin version i have bind the boolean value in my model with the grid column (so the sorting works fine), add an converter (to convert the boolean values to an icon resource) and add an image renderer to show the icon on the grid.
Vaadin 7:
this.addColumn("ABO", Boolean.class).setWidth(75).setMinimumWidth(75)
.setRenderer(new ImageRenderer(), new AboIconConverter());
I found a solution for my problem. I add an additional method to return the abo-icon to my model and define a comparator to sort the column.
Column<MKModel, Resource> colAbo = this.addColumn(MKModel::getAboIcon, new ImageRenderer<>());
colAbo.setComparator(new SerializableComparator<MKModel>() {
@Override
public int compare(MKModel o1, MKModel o2) {
return Boolean.valueOf(o1.getABO()).compareTo(o2.getABO());
}
});