This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Jun 19, 2013, 2:43 AM
110 Posts
topic has been resolvedResolved

Show tooltip even if button is disabled

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 9.0
  • Role: Developer
  • Tags: tooltip,button,disable
  • Replies: 3

I have a button which has its disable property computed to certain condition. A tooltip is attached to this button but it only show when the button is finally enabled. Is there any way to show it even when the button is disabled? I want to achieve this because I need to inform the user via the tooltip as to why the button is disabled.

Jun 19, 2013, 10:55 AM
54 Posts
tooltip

I think the only way to achieve this is to bind the tooltip to a div or tr in wich the button is displayed.

Put a div around the button if necessary and set style padding.

Jun 20, 2013, 5:12 PM
110 Posts
It worked!

I'm using the div although at first I didn't see any padding in the properties but made it successful by setting the style property with value padding:4px. Some weird downside though is that the tooltip will remain there forever if I hover in and out the button too fast and the only workaround is to hover again slowly over the button to make the tooltip disappear. Anyway it's better than nothing. Thanks again!

Jun 21, 2013, 6:05 PM
54 Posts
tooltip2

I found another workaroun or solution, however.

I create a cc:

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" dojoParseOnLoad="true"
    dojoTheme="true">
    <xp:this.resources>
        <xp:dojoModule name="dijit.Tooltip"></xp:dojoModule>
    </xp:this.resources>
    <xp:eventHandler event="onClientLoad" submit="false">
        <xp:this.script><![CDATA[var ID = "#{javascript:compositeData.ElementID}";
el = document.getElementById(ID);
var Pos = findPos(el);
var div = document.getElementById("#{id:buttonDiv}");
div.style.left = Pos[0] + "px";
div.style.top = Pos[1] + "px";
div.style.height = el.offsetHeight + "px";
div.style.width = el.offsetWidth + "px";

function findPos(obj) {
    if (!obj)
        return;
    var curLeft = curTop = 0;
    if (obj.offsetParent){
        do {
            curLeft += obj.offsetLeft;
            curTop += obj.offsetTop;
            } while (obj = obj.offsetParent);
    }
    return [curLeft,curTop];
}
]]></xp:this.script>
    </xp:eventHandler>
    <div id="buttonDiv"
        style="position:absolute;Z-index:2;opacity:0.5;filter:alpha(opacity=50);background-color: #FFFFFF;">
    </div>

    <div dojoType="dijit.Tooltip" connectId="#{id:buttonDiv}"
        showDelay="1" position="below">
        <div
            style="font-weight:bold;font-family:Verdana;width:200px;background-color:lightblue;font-size: 12px;">
            <xp:label
                style="font-family:Arial Baltic,serif;font-size:16pt;color:rgb(255,0,0)">
                <xp:this.value><![CDATA[#{javascript:'BlaBBBB'+ 'www'}]]></xp:this.value>
            </xp:label>
        </div>
    </div>

</xp:view>
 

 

Now you import this cc into your Xpage and fill the compositeData with the Id-name of that button which should work together with the tooltip.

The cc reads the coordinates of the button and positioned the tooltip over the button.

There´s no need to disable the button. It couldn´t be clicked because the div is overlaing the button and.. you can leave the tooltip as fast as you can do it.


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal