-
28 Feb 2008 10:46 AM #1
defaultAlign for QuickTips
defaultAlign for QuickTips
I have an icon near the right-hand side of the screen that has a QuickTip applied using the ext:qtitle and ext:qtip attributes. Works great. Except that I cannot get the defaultAlign to change the tip from its default tl-bl? value, causing the tip to display off the page.
I realize that the Tip.defaultAlign attribute shows it as "experimental," but I'm hoping someone can indicate how to have a tooltip render to the left of its associated element.
BTW, I have dutifuly searched the forums for this...
Thanks in adv, corykv
Then, using the tip in HTML:Code:Ext.QuickTips.init() Ext.apply( Ext.QuickTips.getQuickTip(), { defaultAlign:'l-r', maxWidth:500, minWidth:200, showDelay:200 });
Code:<span id="getanid" ext:qtitle="Test Tip" ext:qtip="This is nothing more than a sample tip.">Furthermore to test tips</span>
-
29 Feb 2008 9:58 AM #2
-
1 Mar 2008 10:09 AM #3
I had the same problem...

HTH, ktp.
PHP Code:Ext.override(Ext.ToolTip,{
adjustPosition : function(x, y){
// do not position outside the Window
var cw = document.documentElement.clientWidth-5;
var ch = document.documentElement.clientHeight-5;
var bw = this.body.getTextWidth();
if(this.title) bw = Math.max(bw, this.header.child('span').getTextWidth(this.title));
bw += this.getFrameWidth() + (this.closable ? 20 : 0) + this.body.getPadding("lr");
var bh = this.getInnerHeight() + this.getFrameHeight() + this.body.getPadding("tb");
if(x + bw > cw) x = cw - bw;
if(y + bh > ch) y = ch - bh;
// do not position under mousecursor
var ay = this.targetXY[1], h = this.getSize().height;
if(this.constrainPosition && y <= ay && (y+h) >= ay){
y = ay-h-5;
}
return {x : x, y: y};
}
});
-
4 Mar 2008 7:51 AM #4
ktp, you rock! Thanks for this fix. It works beautifully and solved the same problem I was having with tips on the right hand side of the screen.
Is this something that the Ext team should look at merging into the core library in a future release?
-
6 Mar 2008 4:27 AM #5
ktp -- awesome -- thanks so much for your timely solution! I really appreciate the help!
-
6 Apr 2008 8:11 AM #6
Is this working for you with IE7?
I don't get any tips at all with this patch?
-
14 Nov 2008 9:10 AM #7
-
17 Nov 2008 2:17 AM #8
I 've had some quirks with the latest releases of ExtJS too...
Here is what worked for me with ExtJS Version 2.2
Yours sincerely,PHP Code:Ext.override(Ext.ToolTip,{
adjustPosition : function(x, y){
// get body dimensions and scroll positions
var b = Ext.get(document.body);
var bs = b.getScroll();
var bw = b.getWidth()-5;
var bh = b.getHeight()-5;
// get min/max values for visible area
var xmin = bs.left + 5;
var xmax = bs.left + bw;
var ymin = bs.top + 5;
var ymax = bs.top + bh;
// Tip dimensions
var tw = this.body.getTextWidth();
if(this.title) tw = Math.max(tw, this.header.child('span').getTextWidth(this.title));
tw += this.getFrameWidth() + (this.closable ? 20 : 0) + this.body.getPadding("lr");
var th = this.getInnerHeight() + this.getFrameHeight() + this.body.getPadding("tb");
// do not position outside the window (max values)
if(x + tw > xmax) x = xmax - tw;
if(y + th > ymax) y = ymax - th;
// do not position outside the window (min values)
if(x < xmin) x = xmin;
if(y < ymin) y = ymin;
// keep the position from being under the mouse
var ay = this.targetXY[1], h = this.getSize().height;
if(this.constrainPosition && y <= ay && (y+h) >= ay){
y = ay-h-5;
}
return {x : x, y: y};
}
});
ktp.
-
13 Aug 2009 12:29 PM #9
Great Fix! That has been bugging me and my users for months!
+1 for making this part of Ext. I can't see having a tooltip off the screen ever being desirable. Is a bug if you ask me.
-
15 Oct 2009 8:09 AM #10
I'm having some issues with this override and Ext 3. Does anyone know if there is a fix for 3.0+ or if this is going to be fixed in a future version of Ext?
Maybe this should/could be moved to the Bugs forum?


Reply With Quote

