Hi,
This is my code:
Column<Image, ThemeResource> imageColumn = grid.addColumn(
i → new ThemeResource(i.getFilename()),
new ImageRenderer());
and my Image class contains:
private ThemeResource image;
with getter and setter:
public ThemeResource getImage()
{
return image;
}
public void setImage(ThemeResource image)
{
this.image = image;
}
Unfortunately the images are broken and are therefore not being displayed (I tried on Firefox, Chrome, Internet Explorer)
How to display images in the Vaadin 8 grid? I followed the instructions but I can not make it work.
Could you help me?
Hi,
you are using Image.getFilename() to crete the ThemeResource.
Is getFilename() relative to the theme folder (/VAADIN/themes/)?
If not, maybe you should anothre type of resource (ClassResource, FileResource or StreamResource)
BTW, you said that your Image model class already has an accessor the the resource so to use it directly you should use