Browsing "Older Posts"

Browsing Category "Tooltip"

Using dynamic tooltips in your Interactive Report

Von Tobias Arnhold → 5.31.2016

Inside an Interactive Report (IR) I had a comment column. The comments in this column could become really large and the users wanted the comments to be automatically trimmed if more then 60 characters were displayed. If the user moved the mouse above a trimmed comment then a tooltip should be display including all comment text.

My first idea was to check for existing plugins which could do this job for me. So I searched on apex.world and found the plugin called "APEX Tooltip" developed by Daniel Hochleitner.

The plugin looked great from what I could see in the example application. When I tried it in my application I found out that all comments must be applied manually in the dynamic action.
Not exactly what I needed. :)

Luckily it was really easy to extend the plugin in a way that I could use it in my IR. To achieve what I need I had to update the javascript file: apextooltip.js
// APEX Tooltip functions
// Author: Daniel Hochleitner
// Updated by Tobias Arnhold
// Version: 1.1

// global namespace
var apexTooltip = {
  // parse string to boolean
  parseBoolean: function(pString) {
    var pBoolean;
    if (pString.toLowerCase() == 'true') {
      pBoolean = true;
    }
    if (pString.toLowerCase() == 'false') {
      pBoolean = false;
    }
    if (!(pString.toLowerCase() == 'true') && !(pString.toLowerCase() == 'false')) {
      pBoolean = undefined;
    }
    return pBoolean;
  },
  // function that gets called from plugin
  showTooltip: function() {
    // plugin attributes
    var daThis = this;
    var vElementsArray = daThis.affectedElements;
    var vTheme = daThis.action.attribute01;
    var vContent = daThis.action.attribute02;
    var vContentAsHTML = apexTooltip.parseBoolean(daThis.action.attribute03);
    var vAnimation = daThis.action.attribute04;
    var vPosition = daThis.action.attribute05;
    var vDelay = parseInt(daThis.action.attribute06);
    var vTrigger = daThis.action.attribute07;
    var vMinWidth = parseInt(daThis.action.attribute08);
    var vMaxWidth = parseInt(daThis.action.attribute09);
    var vLogging = apexTooltip.parseBoolean(daThis.action.attribute10);
    // Logging
    if (vLogging) {
      console.log('showTooltip: affectedElements:', vElementsArray);
      console.log('showTooltip: Attribute Theme:', vTheme);
      console.log('showTooltip: Attribute Content:', vContent);
      console.log('showTooltip: Attribute Content as HTML:', vContentAsHTML);
      console.log('showTooltip: Attribute Animation:', vAnimation);
      console.log('showTooltip: Attribute Position:', vPosition);
      console.log('showTooltip: Attribute Delay:', vDelay);
      console.log('showTooltip: Attribute Trigger:', vTrigger);
      console.log('showTooltip: Attribute minWidth:', vMinWidth);
      console.log('showTooltip: Attribute maxWidth:', vMaxWidth);
      console.log('showTooltip: Attribute Logging:', vLogging);
    }
    for (var i = 0; i < vElementsArray.length; i++) {
      var vaffectedElement = daThis.affectedElements.eq(i);
      // call tooltipster plugin
      $(vaffectedElement).tooltipster({
        theme: vTheme,
        content: $(vaffectedElement).find('.rep_complete_comment').html(),
        contentAsHTML: vContentAsHTML,
        animation: vAnimation,
        position: vPosition,
        delay: vDelay,
        touchDevices: false,
        trigger: vTrigger,
        minWidth: vMinWidth,
        maxWidth: vMaxWidth,
        debug: vLogging,
        functionBefore: function(origin, continueTooltip) {
          $(vaffectedElement).trigger('apextooltip-show');
          continueTooltip();
        },
        functionAfter: function(origin) {
          $(vaffectedElement).trigger('apextooltip-hide');
        }
      });
    }
  }
};
Of course I had to update my IR as well.
First I trimmed the comment column and added a new hidden comment column:
SELECT
-- ...
  CASE WHEN LENGTH(COMMENT_COL) > 60 THEN SUBSTR(COMMENT_COL,1,60)||'...' ELSE COMMENT_COL END AS COMMENT_COL,
  COMMENT_COL as COMPLETE_COMMENT_COL,
from my_table
Then I updated the column attributes:
COMMENT_COL as plain text
- Static ID: rep_comment
- HTML Expression:
#COMMENT_COL#<div class="rep_complete_comment">#COMPLETE_COMMENT_COL#</div>



COMPLETE_COMMENT_COL as hidden column



I also had to add a small css snippet in the page attributes > CSS > Inline to hide the complete comment:
.rep_complete_comment {
display: none;
}

And as a last step I had to implement the tooltip plugin after refreshing the IR:
I used an advanced jQuery selector to get only those comments affected which had more then 60 characters.
td[headers='rep_comment']:contains('...')


The result looked like this:


APEX-AT-WORK no image

Tooltip der Extraklasse

Von Tobias Arnhold → 10.23.2010
Ich hatte ja vor nicht allzu langer Zeit schon erwähnt das ich ne Tooltip Anwendung erstellen wollte. Leider hat es die Zeit nicht ganz zugelassen.

Seit APEX 4.0 sind die Tooltips ja eh dynamisch und eigentlich brauch jetzt niemand mehr ne Speziallösung! Eigentlich...

Es gibt eine Tooltip Art die APEX noch nicht von Haus aus unterstützt: Moveover-Tooltips
Anzeige einer Infobox wenn ich mich über dem Item befinde.

Beispiel: http://www.ta-it-consulting.de/tooltip_example.html

Die Lösung basiert auf dem Quellcode von Swazz mit ihrem Tooltip Plugin: Boxover.
Paulo Vale schrieb bereits über die Integration dieses Tooltips. Damit auch die Deutsche Community dran teilhaben darf, dachte ich mir, ich erweitere die Anleitung und zeige was alles möglich ist.
Leider ist die offizielle Beispielseite nicht mehr Online. Die Javascript Datei könnt ihr hier runterladen: http://ta-it-consulting.de/boxover_tooltip.js

1. Installation - HTML Header:

<!-- TOOLTIP START -->
// Source code
<script type="text/javascript" src="#APP_IMAGES#boxover_tooltip.js"></script>

// Erweitertes Layout
<style type="text/css">
.hlpHeader{font-weight:bold;width:320px;font-family:arial;border:1px solid #6F6F6F;padding:3;fontsize:11;
color:#FFFFFF;background:#8F8F8F;filter:alpha(opacity=85);opacity:0.85;
}

.hlpBody{width:320px;font-family:arial;border-bottom:1px solid #6F6F6F;border-left:1px solid #6F6F6F;
border-right:1px solid #6F6F6F;padding:3;fontsize:11;color:#FFFFFF;background:#BFBFBF;filter:alpha(opacity=85);
opacity:0.85;
}
</style>
<!-- TOOLTIP END -->


2. Konfiguration - Item > HTML Form Element Attributes:

Beispiel 1:
TITLE="header=[Information] body=[Hilfetext fuer dieses Item]"

Beispiel 2:
TITLE="cssbody=[hlpBody] cssheader=[hlpHeader] header=[Information] body=[Hilfetext]"

Beispiel 3:
TITLE="fixedrelx=[1] fixedrely=[-56] header=[Information] body=[Hilfetext]"

Anleitung:
http://opatia.com/js/BoxOverParameters.htm

Einstellungsmöglichkeiten:

































































































ParameterMögliche WerteDefault Beschreibung
headerAny characterblankSpecifies the header text of the caption
bodyAny characterblankSpecifies the body text of the caption
fixedrelxAny integerN/AForces the X-coordinate of the caption to stay fixed (offset is relative to the annotated HTML element)
fixedrelyAny integerN/AForces the Y-coordinate of the caption to stay fixed (offset is relative to the annotated HTML element)
fixedabsxAny integerN/AForces the X-coordinate of the caption to stay fixed (X is an offset relative to the body of the HTML document)
fixedabsyAny integerN/AForces the Y-coordinate of the caption to stay fixed (Y is an offset relative to the body of the HTML document)
windowlockOn / OffOnMake caption stick to side of the window if user moves close to the side of the screen.
cssbodyAny defined style classBuilt in stylesSpecifies CSS class for styles to be used on caption body.
cssheaderAny defined style classBuilt in stylesSpecifies CSS class for styles to be used on caption header.
offsetxAny integer10Horizontal offset, in pixels, of the caption relative to the mouse cursor.
offsetyAny integer10Vertical offset, in pixels, of the caption relative to the mouse cursor.
doubleclickstopOn / OffOnSpecifies whether to halt the caption when the user double clicks on the HTML element with the caption.
singleclickstopOn / OffOffSpecifies whether to halt the caption when the user single clicks on the HTML element with the caption.

- if both singleclickstop and doubleclickstop are set to "on", singleslclickstop takes preference.
requireclickOn / OffOffSpecifies whether the user must first click the element before a
tooltip appears. Intended for use on links so that information appears
while the link is followed.
hideselectsOn / OffOffSpecifies whether to hide all SELECT boxes on page when popup is activated.
fadeOn / OffOffSpecifies whether to fade tooltip into visibility.
fadespeedNumber between 0 and 10.04Specifies how fast to fade in tooltip.
delayAny integer0Specifies delay in milliseconds before tooltip displays.