1. #1
    Ext User
    Join Date
    Feb 2008
    Posts
    5
    Vote Rating
    0
    corykv is on a distinguished road

      0  

    Default 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

    Code:
    Ext.QuickTips.init()
    Ext.apply( Ext.QuickTips.getQuickTip(), {
        defaultAlign:'l-r',
        maxWidth:500,
        minWidth:200,
        showDelay:200
    });
    Then, using the tip in HTML:
    Code:
    <span id="getanid" ext:qtitle="Test Tip" ext:qtip="This is nothing more than a sample tip.">Furthermore to test tips</span>

  2. #2
    Ext User
    Join Date
    Feb 2008
    Posts
    5
    Vote Rating
    0
    corykv is on a distinguished road

      0  

    Default


    <bump>.... anyone?

    TIA.

  3. #3
    Ext User
    Join Date
    Jul 2007
    Posts
    21
    Vote Rating
    0
    ktp is on a distinguished road

      0  

    Default


    I had the same problem...
    HTH, ktp.

    PHP Code:
    Ext.override(Ext.ToolTip,{

        
    adjustPosition : function(xy){
            
            
    // 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.titlebw Math.max(bwthis.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(
    bw cwcw bw;
            if(
    bh chch bh;
            
            
    // do not position under mousecursor
            
    var ay this.targetXY[1], this.getSize().height;
            if(
    this.constrainPosition && <= ay && (y+h) >= ay){
                
    ay-h-5;
            }
            
            return {
    xyy};
        }
        
    }); 

  4. #4
    Ext User
    Join Date
    Feb 2008
    Posts
    180
    Vote Rating
    0
    luv2hike is on a distinguished road

      0  

    Default


    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?

  5. #5
    Ext User
    Join Date
    Feb 2008
    Posts
    5
    Vote Rating
    0
    corykv is on a distinguished road

      0  

    Default


    ktp -- awesome -- thanks so much for your timely solution! I really appreciate the help!

  6. #6
    Ext User
    Join Date
    Apr 2008
    Posts
    1
    Vote Rating
    0
    billyt is on a distinguished road

      0  

    Default


    Is this working for you with IE7?

    I don't get any tips at all with this patch?

  7. #7
    Ext JS Premium Member mcouillard's Avatar
    Join Date
    Jun 2008
    Location
    Bucks County, PA
    Posts
    103
    Vote Rating
    8
    mcouillard will become famous soon enough

      0  

    Default


    Quote Originally Posted by billyt View Post
    Is this working for you with IE7?

    I don't get any tips at all with this patch?
    The patch worked great for me in both FF 3 and IE 7.

    Thank you!

  8. #8
    Ext User
    Join Date
    Jul 2007
    Posts
    21
    Vote Rating
    0
    ktp is on a distinguished road

      0  

    Default


    Quote Originally Posted by billyt View Post
    Is this working for you with IE7?
    I don't get any tips at all with this patch?
    I 've had some quirks with the latest releases of ExtJS too...
    Here is what worked for me with ExtJS Version 2.2

    PHP Code:
    Ext.override(Ext.ToolTip,{

        
    adjustPosition : function(xy){
            
            
    // 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.titletw Math.max(twthis.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(tw xmaxxmax tw;
            if(
    th ymaxymax th;
            
    // do not position outside the window (min values)
            
    if(xminxmin;
            if(
    yminymin;
            
            
    // keep the position from being under the mouse
            
    var ay this.targetXY[1], this.getSize().height;
            if(
    this.constrainPosition && <= ay && (y+h) >= ay){
                
    ay-h-5;
            }
            return {
    xyy};
        }
        
    }); 
    Yours sincerely,
    ktp.

  9. #9
    Sencha User charleshimmer's Avatar
    Join Date
    Jul 2008
    Location
    Austin, TX
    Posts
    329
    Vote Rating
    0
    charleshimmer is on a distinguished road

      0  

    Default


    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.

  10. #10
    Ext JS Premium Member nateirwin's Avatar
    Join Date
    Oct 2007
    Location
    Denver, Colorado, USA
    Posts
    69
    Vote Rating
    0
    nateirwin is on a distinguished road

      0  

    Default


    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?