PDA

View Full Version : ToolTip bug? The 'show' event fires twice and it seems impossible to anchor it.



Dr. Flink
26 Apr 2010, 12:37 AM
Hi,

I have some serious problems with the tooltip component. What I'm trying to do is to place it so that the anchor arrow is pointing towards a panel tool (up).
I've tried most things when it comes to using anchor and defaultAlign attributes, without success.
Now I've given up my hopes on these attributes and instead try to place the tooltip using el.alignTo() when the tooltip is shown (listening to the show event).
But even this fails. Show event is fired twice and at the second time everything is as it should be. BUT, something happens after that and the tooltip jumps out of position.
If I use the afterlayout listener it works the first time the tooltip is shown, but the other times it will be misplaced.

I've run out of idees, can someone point me in the right direction plz?



oChannel.on('afterrender', function(o) {
var icon = o.getEl().child('.x-tool-down');
icon.on('load', function() {alert('LOADED!!!')});
TV.Help['center-panel-channel'] = new Ext.ToolTip({
cls: 'help-bubble',
target: o.getEl().child('.x-tool-down'),
renderTo: document.body,
anchorToTarget: true,
html: 'Dölj och visa alla program<br/>för den här kanalen',
anchor: 'top',
renderTo: Ext.get('center-panel'),
anchorOffset: 83,
closable: true,
autoHide: false,
i: 1, // Only testing
listeners: {
show: function(tt) {
tt.getEl().alignTo(tt.target, 't-b', [-26, 10]);
alert('Show event #' + tt.i); // Only testing
tt.i++; // Only testing
}
}
});
TV.Help['center-panel-channel'].getEl().alignTo(o.getEl().child('.x-tool-down'), 't-b', [-26, 10]);
});


First show-event fired
http://clarinet.se/extjs/forum-images/tt-error-1.png

Second show-event fired (this is how it's supposed to be)
http://clarinet.se/extjs/forum-images/tt-error-2.png

After the second show-event, something makes the tooltip to jump out of possition
http://clarinet.se/extjs/forum-images/tt-error-3.png