Back to the index of articles and examples

DataTable with Tooltips

In this example we are assuming the Description for the Items was too long so instead of populating the table with it, we show it as a Tooltip when the cursor lies on the Item column. The code listens to DataTable's own cellMouseoverEvent and cellMouseoutEvent and handles its own timers to show and hide the tooltip. There is only one Tooltip for the whole of the DataTable which is set on the fly when the cursor remains for half a second on any cell in the Item column. The text for the Tooltip is taken from the extra filed in the Record object which is not displayed and the location is also calculated from the cursor coordinates when the event was triggered.