HTML content in description of grid cells


with the old Table class it was possible to render HTML as a tooltip of a cell by setting the description on a label and returning the label as the component for the cell. How to do that in Vaadin 8 with Grid? I tried using setDescriptionGenerator but that is renderer as normal text and not as HTML.

Thanks in advance.


Hi Michael,

you need to add HTMLRenderer to your column in grid, for instanc grid.addColumn(item -> VaadinIcons.DOWNLOAD.getHtml(), new HtmlRenderer()).setId(Columns.DOWNLOAD.dtoName) and then

grid.getColumn(Columns.DOWNLOAD.dtoName).setDescriptionGenerator(row -> "your html code");

Just having HtmlRenderer as a renderer didn’t do the job.

My code:

       table.addColumn(mapPresentation -> {
            Position position = positions.get(mapPresentation.getPositionId());
            Integer employeeId = position.getCurrentStaffingEmployeeId();
            if (employeeId == null) {
                return "nicht besetzt";
            else {
                Employee employee = getEmployee(employeeId);
                return (employee == null) ? StringUtils.EMPTY : employee.getName();
        }, new HtmlRenderer()).
            setDescriptionGenerator(mapPresentation -> { return buildCellDescription(mapPresentation, positions); });

Still rendered as plain text (and not HTML).

Anything wrong with my code?

Oh sorry, HTMLRenderer is for data in cell.
Your code is OK.
I`ve tried to insert HTML tag in setDescriptionGenerator

grid.getColumn(Columns.DOWNLOAD.dtoName).setDescriptionGenerator(row -> "<b>Click</b>"); But without luck.

Any news on that one? I can only set the ContentMode with “setDescription” for the component itself but I don’t see the possibility with the DescriptionGenerator or am I missing something?

I would be interested in this as well. Is this feature planned for 8.1?

I would also be very interested in this feature (especially since it was present in Vaadin 7 and our customers got used to it …)

For this issue please upvote:

I have a workaround for this Problem.
Label has the ContentMode setter, so just use ComponentColumn :slight_smile:
something like this :

insted of
.setDescriptionGenerator(item → “HTML description”); //NO easy way to set ContentMode to HTML

addComponentColumn(item-> {
Label label = new Label(item.getValue());
label.setDescription(“HTML description”, ContentMode.HTML); //easy :slight_smile:
return label;

Finally its possible to set an HTML description (tested with Vaadin 8.3.3):

gridColumn.setDescriptionGenerator(e -> "<b>some html code</b>", ContentMode.HTML);