Quantcast
Channel: Grassroots Oracle
Viewing all articles
Browse latest Browse all 405

Extend column tooltip to table cell

$
0
0
Quite sometime ago while still on 3.x I described a simple way to add tooltips in a report using standard HTML in a HTML Expression.
<span title="#RECENT_NOTE#">#MY_COLUMN#</span>

However, it will only appear when hovering over the span content, not anywhere within the table cell.

To do so we can add a dynamic action to execute some JavaScript after refresh of the relevant region.
$('td[headers=my_column] span').each( // for every data cell in the column
function() {
// copy the title attribute to the parent cell
     $(this).parent().attr('title',  $(this).attr('title'));
});
This JavaScript copies the title attribute from the inner span to the surrounding td tag, so you will see the tooltip when the cursor is anywhere within the cell. I find this relevant when there is a bit of spacing/padding in the report.

In another post I'll describe how you could display this tooltip on tap of the cell, useful when used within touch devices.

Viewing all articles
Browse latest Browse all 405

Trending Articles