View Full Version : Tooltip doesn't move while scolling layout region

16 Oct 2010, 7:19 AM

I have a problem with Tooltip.
It is tergeted to some <img> element which is in east region (layout).
Ease region is scrollable so if there's more content i can scroll it down and up but Tooltip stays at the same position.

I tried this from an Sencha example page (there's no regions just plain html page):

new Ext.ToolTip({
renderTo: 'center',
target: 'img_concomitant',
html: 'Click the X to close me!!!',
title: 'My Tip Title',
autoHide: false,
closable: true,
resize: function() {alert('ok);}

But unfortunately it doesn't work.

I have tried to use renderTo, anchorToTarget, closable - with no effects.

I will be pleased if anyone could help me with this problem.

16 Oct 2010, 7:44 AM
By default a Tooltip renders to the document body.

Render it to the Element which you are scrolling, and it should then scroll with it.

16 Oct 2010, 8:15 AM
Thanks again Animal, big BEER for You ;)

16 Oct 2010, 8:18 AM
Thanks again Animal, big BEER for You ;)

Are you coming to the conference? They have good beer in SF!

18 Oct 2010, 3:23 AM
I wish I could. I am sure in future I will be able to get to US. At the moment I live in Poland (EU) where we have a lot of paper work with traveling to US.

By the way, I have used your solution and it work fine but I have different problem. When I reload a content in a region tooltip doesn't show and I get an error in firebug (b in null, etc.) I have set render dynamicaly by:

/* anchor point */
Ext.getCmp('querywindow').initTarget('img_' + el);

When I set render() first time it works well, but next reload of region where I have Tooltip's target element causes errors.
Any idea why?

18 Oct 2010, 3:37 AM
One ToolTip with an id "querywindow"? And you "re-target" it on the newly added Panel?

You cannot render twice. You will have to programmatically move the ToolTip's element to its new parent node: The new Panel's body.

18 Oct 2010, 3:46 AM
Thanks, second BEER goes to your direction... :)

18 Oct 2010, 4:39 AM

18 Oct 2010, 4:46 AM
I would be pleased if you could tell how to: "programmatically move the ToolTip's element to its new parent node: The new Panel's body" because I'm trying with no effort, thanks.

18 Oct 2010, 5:23 AM
All Components have getEl() Including a ToolTip

Panel has a body element.

19 Oct 2010, 3:38 AM
OK, then I'm trying thus. Thanks :)