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.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
CssImport when using Component Exporter by Mikhail Shabarov, 1 month ago
Framework 7 to 8 convertion setCellDescriptionGenerator
Can somebody help converting this from 7 to 8?
grid.setCellDescriptionGenerator(new Grid.CellDescriptionGenerator() {
@Override
public String getDescription(Grid.CellReference cellReference) {
c1 = "cell1".equals(cellReference.getPropertyId());
c2 = "cell2".equals(cellReference.getPropertyId());
c3 = "cell3".equals(cellReference.getPropertyId());
c4 = "cell4".equals(cellReference.getPropertyId());
descr = (String)cellReference.getItem().getItemProperty("description").getValue();
return ((c1 || c2 || c3 || c4)?descr:null);
}
});
Last updated on
Grid<MyPojo> grid = new Grid<>(MyPojo.class);
grid.getColumns().stream()
.filter(column -> "cell1".equals(column.getId()) || "cell2".equals(column.getId())
|| "cell3".equals(column.getId()) || "cell4".equals(column.getId()))
.forEach(column -> column.setDescriptionGenerator(pojo -> pojo.getDescription()));
or with each individual column
private String getDescription(MyPojo pojo) {
return pojo.getDescription();
}
Grid<MyPojo> grid = new Grid<>(MyPojo.class);
grid.getColumn("cell1").setDescriptionGenerator(this::getDescription);
grid.getColumn("cell2").setDescriptionGenerator(this::getDescription);
grid.getColumn("cell3").setDescriptionGenerator(this::getDescription);
grid.getColumn("cell4").setDescriptionGenerator(this::getDescription);
Last updated on
You cannot reply to this thread.