I was looking at thread dealing with two things:
- Truncate long values by showing '...' in order to maintain the row height standard throughout the grid
- Activate tool-tip to show the complete cell value
I stumbled across this thread: listview make content ellipses and show tooltip when width of content exceeds 240px
Someone posted this utility method over there:
function
gridHeaderTooltip( kendoGrid, tooltipPosition, filterSelector ) {
kendoGrid.kendoTooltip({
filter: filterSelector,
position: tooltipPosition,
content:
function
(e) {
var
target = e.target;
return
$(target).text();
},
beforeShow:
function
(e) {
var
isActive = isEllipsisActive(e.target[0]);
if
(!isActive) {
e.preventDefault();
}
}
});
}
function
isEllipsisActive(e) {
return
(e.offsetWidth < e.scrollWidth);
}
kendo.ui.Tooltip.fn._show =
function
(show) {
return
function
(target) {
var
e = {
sender:
this
,
target: target,
preventDefault:
function
() {
this
.isDefaultPrevented =
true
;
}
};
if
(
typeof
this
.options.beforeShow ===
"function"
) {
this
.options.beforeShow.call(
this
, e);
}
if
(!e.isDefaultPrevented) {
show.call(
this
, target);
}
};
}(kendo.ui.Tooltip.fn._show);
How do I use this (or where do i plug it) to achieve my two points above?