View Full Version : Tooltip, force show

29 Dec 2010, 7:44 AM
Hi, i found a way to force showing a tooltip over a desired object; like this:

var object = myObjectInstance;
var location = object.el.getXY();
var objectHeight = object.getHeight()+4;
var t = new Ext.ToolTip({
target: object.id,
anchor: 'top',
anchorOffset: 85,
html: '<div style="padding:8px;">text goes here</div>'
t.showAt([location[0], location[1]+objectHeight]);

The problem is that the tooltip is showing but allways without the small pointer on top:

...and what i need is this:

..if i move over the object, the pointer on top appears correctly but when i force the tooltip show it doesn't.

Any ideias? Thanks!!!

30 Dec 2010, 7:45 AM
Ok, the solution is allways very simple, here's how:

var location = object.el.getXY();
var tooltip = new Ext.ToolTip({
anchor: 'top',
anchorToTarget: false,
targetXY: [location[0]+15, location[1]],
hideDelay: 15000,
closable: false,
html: '<div style="padding:8px;">' + text + '</div>'

I guess there's a huge difference between show and showAt, in terms of how
the tooltip gets displayed. Or i might be missing something!