Hello. I am having the most frustrating time trying to figure out what I think should be fairly easy.
I want to show extra data when hovering over a cell on grid.
I have found many examples on how to do this in 3 lines of code but for like Vaadin 7 or 8. When I try to replicate this in version 14, the object model is completely different.
How do I pull this off with the Vaadin version 14 grid?
Hi Johannes.
Initially for right now just a simple tooltip but I think in the future as users see this they will want it to be a formatted area.
So… Yes.?
Sorry for delay. I don’t think there’s any Java API for setting a tooltip. Maybe you could use a template renderer and then set the title of the generated HTML.
Something like this:
Grid<Person> grid = new Grid<>();
grid.addColumn(TemplateRenderer.<Person> of("<span title='[[item.description]
]'>[[item.value]
]</span>").withProperty("value", Person::getFirst).withProperty("description", p -> "Generate a description"));
grid.addColumn(Person::getLast);
grid.setItems(Arrays.asList(new Person("John", "Doe")));
add(grid);
At the end of the day I started going with the Tooltip component from Vaadin which does a lot of cool stuff
with but requires a Vaadin Prime subscription so I kept digging and found the awesome TooltipExtension Add-on by Katri Haapalinna which does just about everything I needed.