adds a tooltip over an HTML element or a view
target | string|HTMLElement | the ID of the target HTML element or the HTML element itself |
config | string|object | the text of the tooltip or the config for custom tooltip behavior |
addTooltip() adds the target area in the list of areas over which the common tooltip instance is shown. If this area is the first one, addTooltip() creates the tooltip instance.
You can create a simple tooltip that will appear over an HTML area:
webix.TooltipControl.addTooltip("list","Books by Jeff Noon");
Where "list" is the ID of a div like this:
<div id="list">
...
</div>
You can also create tooltips for Webix views:
{
view:"datatable", id:"grid",
// ...config
}
// ...
webix.TooltipControl.addTooltip($$("grid"),"Books by Jeff Noon");
The addTooltip function can be used for customizing tooltips, for example creating dynamic tooltips for HTML elements:
webix.TooltipControl.addTooltip("annotation", {
$tooltipIn:function(node){
let tooltip = webix.TooltipControl.getTooltip();
tooltip.define("template", function(){
return node.value || "Nothing here";
});
return node;
}
});
where "annotation" is the ID of the following textarea:
<textarea rows="5" cols="40" name="annotation" id="annotation">
Some book annotation is here
</textarea>
The config object can have the following properties that can be redefined: