I would like to accomplish the behavior shown in this example with Kendo React.
$("#grid").kendoTooltip({
filter: "th:nth-child(2)", // Select the th elements of the Grid.
position: "bottom",
content: function(e){
// Return the text content of the hovered header.
return e.target.text();
}
}).data("kendoTooltip");
With Kendo React I'm doing the following
<Tooltip
filter={(target) => target.matches("th:nth-child(2)")}
position="bottom"
content={({ target }) => target.textContent}
anchorElement="target"
>
<Grid
ref={(instance) => {
if (instance) {
const columnHeaders = instance.element.querySelectorAll("th:nth-child(2)");
columnHeaders.forEach((header) => {
header.setAttribute("title", "something for tooltip to work");
});
}
}}
>...</Grid>
</Tooltip>
This works fine if I hover over the blank space around the column header text (target = <th>), but if I hover over the column header text (target: <span> within <th>) the tooltip doesn't show. If I make the modification below then it shows, but the position is wrong, the tooltip shows right below the text and not below the <th> element.
<Tooltip
filter={(target) => target.matches("th:nth-child(2)") || target.closest("th:nth-child(2)")}
position="bottom"
content={({ target }) => target.textContent}
anchorElement="target"
parentTitle
>
<Grid
ref={(instance) => {
if (instance) {
const columnHeaders = instance.element.querySelectorAll("th:nth-child(2)");
columnHeaders.forEach((header) => {
header.setAttribute("title", "something for tooltip to work");
});
}
}}
>...</Grid>
</Tooltip>
The example below has the behavior I want to achieve with Kendo React. No matter where I hover within my filter selector it shows the tooltip with respect to the filter selector.
https://docs.telerik.com/kendo-ui/knowledge-base/grid-with-kendo-ui-tooltip