Attach Tooltip API
Attach Tooltip Overview
Attach Tooltip provides a means for attaching tooltips to various elements in the DOM. The Attach Tooltip grade is not intended to be used on its own, but provided as a base grade to another component that will use it's capabilities for binding tooltips.
Adding an Attach Tooltip to a Component/Grade
To mixin the Attach Tooltip into your Component/Grade:
fluid.defaults("my.component", { gradeNames: ["gpii.firstDiscovery.attachTooltip", "autoInit"] });
Grades
The base grades used by the Attach Tooltip:
Model
Path | Description | Values | Default |
---|---|---|---|
| The index of the currently selected element |
| undefined |
Subcomponents
Name | Description | Values | Default |
---|---|---|---|
| Specifies the tooltip component to use to create the tooltips. | "fluid.tooltip" | tooltip: { type: "fluid.tooltip", container: "{attachTooltip}.container", options: { gradeNames: ["gpii.firstDiscovery.tts.tooltipHookup"], model: { idToContent: { expander: { func: "{that}.getTooltipModel" } } }, invokers: { updateIdToContent: { changePath: "idToContent", value: { expander: { funcName: "{that}.getTooltipModel" } } }, getElementInfo: { funcName: "gpii.firstDiscovery.attachTooltip.getElementInfo", args: ["{fluid.messageResolver}", "{arguments}.0", "{arguments}.1"] }, getTooltipModel: { funcName: "gpii.firstDiscovery.attachTooltip.getTooltipModel", // Specifying each elements in the argument list to force them to resolve. args: ["{attachTooltip}.dom", "{attachTooltip}.options.tooltipContentMap", "{that}.getElementInfo", "{attachTooltip}"] } } } } |
Options
Name | Description | Values | Default |
---|---|---|---|
| Options to be passed down to the tooltip subcomponent. | (see: fluid.tooltip) | tooltipOptions: {} |
| Defines the mapping between the names in the selectors block and message bundle for dom elements to have tooltips. Two methods to define mappings:
|
| tooltipContentMap: {} |
Dependencies
<script type="text/javascript" src="src/lib/infusion/infusion-custom.js"></script> <script type="text/javascript" src="src/js/msgLookup.js"></script> <script type="text/javascript" src="src/js/tooltip.js"></script>