I have a column in a grid that contains labels. These labels include icons, text and descriptions upon mouseover (hover). The description is also shown for the label text, which I want to prevent. The ideal scenario is that the description is shown upon mouseover (hover) of the icon, but not for the label text itself. I find this difficult to do, as the .setDescription(String string)
method is available only for components such as labels. Is there a way to achieve what I outlined, preferably using Java, but if not also using CSS or some other "hacks"?

- 1,362
- 3
- 22

- 617
- 7
- 22
-
Do your descriptions ever wrap, or is it just an icon next to a short text? – Anna Koskinen Jul 23 '21 at 14:54
1 Answers
Hacking the Vaadin 8 tooltip handling is not quite trivial, you'd need to do some extending on the client-side to get access to that logic. I did that some ago for my GridActionRenderer add-on, and looking at my code I overrode GridConnector.getTooltipInfo, and then added the tooltip data to all the required elements, separately, and in my case one cell needed multiple tooltips, so I had to send the description data separately too. The connector whose tooltip handling you need to hijack depends on how you are planning to do that, if you go with a custom renderer route like I did it's the Grid's connector, but if you are using a component column then I think it would need to be that component's connector.
If it's possible for you to separate the icons to a completely different component instead, so that you could still use the default tooltip handling, that might be an easier solution.

- 1,362
- 3
- 22