Hello,
I'm using the following custom code for tooltips:
01.$('#' + tooltipContainerDivId).kendoTooltip({02. filter: filter,03. position: 'right',04. animation: {05. open: {06. effects: 'fade:in',07. duration: 20008. },09. close: {10. effects: 'fade:out',11. duration: 20012. }13. },14. // Show tooltip only if the text of the target overflows with ellipsis.15. show: function() {16. var cWidth = computeElementWidth(this.content, tooltipWidthWorkaroundDivId);17. if (this.content.text().trim() !== '') {18. $('[role="tooltip"]').css({19. width: cWidth + 10,20. visibility: 'visible'21. });22. }23. },24. hide: function() {25. $('[role="tooltip"]').css('visibility', 'hidden');26. },27. // Apply additional custom logic to display the text of the relevant element only.28. content: function content(e) {29. var $element = $(e.target[0]);30. var cWidth = computeElementWidth($element, tooltipWidthWorkaroundDivId);31. var dataTooltipAttr = $element.attr('datatooltip');32. 33. if (cWidth > $element.width() || dataTooltipAttr) {34. // Text was truncated, or we have a custom tooltip message.35. if (dataTooltipAttr) {36. return dataTooltipAttr;37. }38. 39. return e.target.text();40. } else {41. return '';42. }43. }44.});The main reason for this is to display tooltip only if the text would be too short to fit within a grid cell.
This is working fairly well, the only major problem that we have with this is that the little arrow indicator is sometimes not aligned properly. If I remove this custom code, the arrow is always correctly aligned. I assume that internally there is some code that positions the arrow based on the box that kendo builds, but since I resize this box, the arrow is then positioned incorrectly.
What would be the proper way to solve my problem ? Is there already a way to perform the behaviour that I want ? the thing is there are also some cases where we always want to display the tooltip because it contains extra information not displayed in the cell, so I think that either way we need custom code.
Is there a way to override the way the arrow position is computed ?
As we can see on both the attached screenshots, the arrow's position is in both cases not quite right, and it seems to depend on what element I hovered previously, if I hover the element above I get something, and if I hovered the element below I get something else when I come back to that element from the attached screenshot.
Thanks !