View Full Version : Tooltip not showing on first hover

2 Jul 2010, 5:27 AM
I added a simple tooltip to my dataview but can't really get it to work properly. Otherwise it works fine but the tooltip does not show on the first hover, you have to hover a second time to get the tooltip and then it works every time.

the tooltip trigger, dataview on 'mouseenter'

'mouseenter': {
fn: function(dataView, index, node, e) {
var record = dataView.getRecord(node);
drawLocation(record.data.lon, record.data.lat, 'hover', record.data.id);
scope: this

the tooltip function

showHoverInfo: function(data) {
var target = Ext.get('img_'+data.filename);

new Ext.ToolTip({
target: target,
title: '',
autoWidth: true,
'<div class="img-tooltip">' +
'<b>' +data.header+ '</b> by ' +data.username+ '<br>' +
'<span class="img-tooltip-desc">' +data.description+ '</span>' +
trackMouse: true,
dismissDelay: 10000,
anchor: 'right'

The tooltip function runs every time but it just won't draw the tooltip.

Any ideas? Probably rather simple solution :)

2 Jul 2010, 5:34 AM
A tooltip shows when the mouse enters the target, but you are creating the tooltip when the mouse is already over the target.

Create the tooltip when the page is created and create it only once (your code would create the tooltip EVERY time the mouse hovers over an item).

ps. Have you seen Animal's DataTip user extension? That would save you a lot of memory because it only creates one tooltip for the entire dataview.

5 Jul 2010, 12:29 AM
Ok thanks, I'll have a look at it.

Animal's plugin was the perfect solution, thanks again.