From 0bbe5b64096bd8127d6e9d48893df45714d3a8bb Mon Sep 17 00:00:00 2001 From: tr4npt Date: Sat, 22 Apr 2023 14:03:52 -0500 Subject: [PATCH 1/2] 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. --- plugins/slick.autotooltips.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/slick.autotooltips.js b/plugins/slick.autotooltips.js index 1700490a..19640f02 100644 --- a/plugins/slick.autotooltips.js +++ b/plugins/slick.autotooltips.js @@ -56,7 +56,9 @@ if (options.maxToolTipLength && text.length > options.maxToolTipLength) { text = text.substr(0, options.maxToolTipLength - 3) + "..."; } - } else { + } else if ($node.innerHeight() < $node[0].scrollHeight) { + text = $.trim($node.text()); + } else { text = ""; } $node.attr("title", text); @@ -86,4 +88,4 @@ "pluginName": "AutoTooltips" }); } -})(jQuery); \ No newline at end of file +})(jQuery); From bcb616efafd04d47f37f9a38f65832f6d9568b97 Mon Sep 17 00:00:00 2001 From: tr4npt Date: Sun, 23 Apr 2023 23:45:29 -0500 Subject: [PATCH 2/2] combined height check with width check --- plugins/slick.autotooltips.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/slick.autotooltips.js b/plugins/slick.autotooltips.js index 19640f02..55b7fb0a 100644 --- a/plugins/slick.autotooltips.js +++ b/plugins/slick.autotooltips.js @@ -51,13 +51,11 @@ 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 if ($node.innerHeight() < $node[0].scrollHeight) { - text = $.trim($node.text()); } else { text = ""; }