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.
ThemeResource in a Grid with HtmlRenderer
I would like to use a ThemeResource in a Grid with the HtmlRenderer. Is this possible? Something like
grid.addColumn(object -> {
return "<div>" + resource.toHtml() + "</div>;
}, new HtmlRenderer());
Thanks in advance.
Mihael
Sorry for the late reply.
The actual URL of a theme resource is normally resolved on the client side, so on the server there is no method to get a complete URL for a theme resource. However, in a basic deployment, the path is something like contextPath + "/VAADIN/themes/" + myUi.getTheme() + "/" + resource.getResourceId() . If you know the server base URL and the context path, you could create your own helper to construct such paths.
Alternatively, if you don't need any other HTML around the ThemeResource, you could use an ImageRenderer which directly supports resources.
Not nice but a valid workaround.
Thanks for the effort.