Hi Kendo team,
I have a grid to which I want to attach a tooltip;
the tooltip should be shown only if the content of the gridcell is bigger than the cell, and the tooltip simply contains the text content of the cell.
I am not able to achieve this simple task.
First I filtered for grid elements and I inserted the processing in the content property as
grid.table.kendoTooltip({
filter: "td:not(:empty)", //no tooltip for empty field
content: function (e) {
var target = e.target; // element for which the tooltip is shown
if (isEllipsisActive(target[0])) {
return $(target).text();
}
else {
return "";
}
},
show: function (e) {
this.popup.wrapper.width("auto");
},
autoHide: true,
position: "bottom"
});
function isEllipsisActive(e) {
return (e.offsetWidth < e.scrollWidth);
}
This approach substantially works, but for items that are totally visible, still a small gray stripe is shown as empty tooltip.
I thought to attach the processing to filter property, but I am not able to call a function from the filter property, i.e. something like
filter: function (e) {
var target = e.target;
if (target[0].role == "gridcell) {
if (isEllipsisActive(target[0])) {
return true;
}
}
return false;
},
Please give me a hint
Best regards and best wishes of Merry Christmas to all the team
Marco
I have a grid to which I want to attach a tooltip;
the tooltip should be shown only if the content of the gridcell is bigger than the cell, and the tooltip simply contains the text content of the cell.
I am not able to achieve this simple task.
First I filtered for grid elements and I inserted the processing in the content property as
grid.table.kendoTooltip({
filter: "td:not(:empty)", //no tooltip for empty field
content: function (e) {
var target = e.target; // element for which the tooltip is shown
if (isEllipsisActive(target[0])) {
return $(target).text();
}
else {
return "";
}
},
show: function (e) {
this.popup.wrapper.width("auto");
},
autoHide: true,
position: "bottom"
});
function isEllipsisActive(e) {
return (e.offsetWidth < e.scrollWidth);
}
This approach substantially works, but for items that are totally visible, still a small gray stripe is shown as empty tooltip.
I thought to attach the processing to filter property, but I am not able to call a function from the filter property, i.e. something like
filter: function (e) {
var target = e.target;
if (target[0].role == "gridcell) {
if (isEllipsisActive(target[0])) {
return true;
}
}
return false;
},
Please give me a hint
Best regards and best wishes of Merry Christmas to all the team
Marco