List, ItemRenderer, toolTip… oh my!

On my latest project, I was going through several areas of the application adding toolTips to make some of the data that is clipped visible if desired. In doing so, I found out that I needed to use a combination of the different types of tips available.

Most components have a toolTip property that you can set (typically bound to some data). But the List-based components are a little different. They use dataTipField and the dataTipFunction. The “data” version of toolTips is based on the list iterating through it’s dataProvider and then adding toolTip for each row.

So, while adding toolTips to a List with an itemRenderer, I ran into a problem. My toolTips weren’t showing up when I set the dataTipField. The dataTipFunction didn’t work either. What gives?!

Well, I had an inline itemRenderer for my list. And apparently the List doesn’t like adding toolTips, via the dataTipField, to a component that is inline.

The solution: Simply add a toolTip to the inline component. And in my case, bind it to the data property that is passed in by the list.

Note: You don’t even need to set showDataTips to true.