Skip to content

Commit

Permalink
show tooltip if the cell content is taller than the cell height - fixes
Browse files Browse the repository at this point in the history
#740 (#741)

* show tooltip if the cell content is taller than the cell height

The current code does not show a tooltip when word wrap is turned on and the text is taller than the cell height.

* combined height check with width check
  • Loading branch information
tr4npt authored Apr 25, 2023
1 parent 9fa0860 commit a457d20
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugins/slick.autotooltips.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
var $node = $(_grid.getCellNode(cell.row, cell.cell));
var text;
if (!$node.attr("title") || options.replaceExisting) {
if ($node.innerWidth() < $node[0].scrollWidth) {
if (($node.innerWidth() < $node[0].scrollWidth) || ($node.innerHeight() < $node[0].scrollHeight)) {
text = $.trim($node.text());
if (options.maxToolTipLength && text.length > options.maxToolTipLength) {
text = text.substr(0, options.maxToolTipLength - 3) + "...";
}
} else {
} else {
text = "";
}
$node.attr("title", text);
Expand Down Expand Up @@ -86,4 +86,4 @@
"pluginName": "AutoTooltips"
});
}
})(jQuery);
})(jQuery);

0 comments on commit a457d20

Please sign in to comment.