Dynamically Assign Single Dojo Tooltip To Multiple Nodes
Imagine that we have a widget with a list of nodes (e.g. divs). We would like to display a Dojo Tooltip on mouseover. The elements inside are generated dynamically, so we have to a
Solution 1:
You could do something like this for the tooltip.
Remember you need to require dojo/query
in your widget definition.
postCreate: function() {
var _this = this;
var containerNode = this.domNode; // Assuming that the widget has a domNode
var fooTooltip = new Tooltip({
connectId: query('.list-container', containerNode ), // Search the Node starting at the containerNode.
selector: '.list-container-item',
getContent: function(matchedNode) {
console.debug('this is a tooltip for ', matchedNode);
}
});
}
Post a Comment for "Dynamically Assign Single Dojo Tooltip To Multiple Nodes"