Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#14654 closed enhancement (fixed)

Tooltip: support multiple tooltips via one dijit.Tooltip through delegation

Reported by: bill Owned by: bill
Priority: high Milestone: 1.8
Component: Dijit Version: 1.7.1
Keywords: Cc:
Blocked By: Blocking:


Add new attributes to Tooltip allowing a single Tooltip instance to be applied to a set of nodes, and display a different Tooltip for each of them. This would make dijit.Tooltip practical for displaying tooltips for rows of a a Grid or Tree because it would eliminate the overhead of setting up event handlers per-node, and precomputing the tooltip text for each row.

Probably an API like this:

new Tooltip({ 
   connectId: myTable,
   selector: "td",
   getContent: function(matchedNode){ return ...; /* String */}

This example would setup delegation on a <table> node, monitoring mouseenter/mouseleave (and also focusin/focusout) on each <tr>. When the user hovered over a <tr> it would display the tooltip, but it would get the text dynamically through getContent() (or getText()?).

Will of course leverage dojo/on's delegation feature.

Change History (4)

comment:1 Changed 7 years ago by bill

PS: should have something similar for context menus, perhaps creating the actual Menu widget (or at least the DOMNodes) on-demand. That would certainly be a win for TabContainer, which is currently creating a separate context menu for every closable TabButton in order to meet a11y requirements.

comment:2 Changed 7 years ago by bill

Resolution: fixed
Status: newclosed

In [27677]:

Add selector parameter and getContent() method so that a single dijit.Tooltip can be applied to many rows in a table, or many nodes in a Tree, etc.

Fixes #14654 !strict.

comment:3 Changed 7 years ago by bill

In [27678]:

add comment, refs #14654 !strict.

comment:4 Changed 7 years ago by bill

In [28293]:

Add comments that dojo/query needed for on.selector(), Menu.selector, and Tooltip.selector. Refs #14812, #14654 !strict.

Last edited 7 years ago by bill (previous) (diff)
Note: See TracTickets for help on using tickets.