0 votes
1.6k views
in Coach Views by (120 points)
edited by
Hi,

I wanted to add a tooltip on the table header. Can someone please help me with this. I have tried to add a table insert the tooltip, unfortunately, the label heading was not displaying and when I select show label then the label was showing outside the table.

1 Answer

0 votes
ago by (30.6k points)

The column header of the UI Toolkit table is plain HTML you can reach after the table renders; give the header cell a title (native tooltip) or a Bootstrap tooltip:

// Table control > Events > On rendered  (or the coach view's load event after the table exists)
var el = ${Orders}.context.element;                     // the table's DOM root
var tips = { "Amount": "Net amount without tax", "Due": "Contractual due date" };
el.querySelectorAll("thead th").forEach(function (th) {
  var label = th.textContent.trim();
  if (tips[label]) { th.setAttribute("title", tips[label]); th.style.cursor = "help"; }
});
// Bootstrap tooltip (jQuery + Bootstrap 3 are on the coach page):
$(el).find("thead th[title]").tooltip({ container: "body", placement: "top" });

Why the "insert a control in the header" attempt failed: the header text comes from the column label option and is rendered by the table; controls can only be placed in cells. The header label may contain HTML on newer toolkits (Allow HTML in labels) - then <span title="...">Amount</span> as the label works without JavaScript.

For a richer hint use the UI Toolkit Popover control anchored to the header: ${Popover}.setTarget(th) is not exposed, so attach the Bootstrap popover directly: $(th).popover({ content: "...", trigger: "hover" }).

References

Related questions

0 votes
1 answer 1.2k views
asked Feb 13, 2021 by Manana (190 points)
+1 vote
1 answer 4.9k views
0 votes
1 answer 2.3k views
0 votes
1 answer 1.0k views
+1 vote
1 answer 1.2k views
0 votes
1 answer 2.7k views
0 votes
1 answer 4.1k views

723 questions

807 answers

98 comments

4.9k users

Join BPM Community Discord Channel

Welcome to BPM Tips Q&A, Community wiki/forum where you can ask questions and receive answers from other IBM BPM experts and members of the community. Users with 2000 points will automatically be promoted to expert level.
Created by Dosvak LLC
Our Youtube Channel
...