Kendo UI Tooltip on show,访问目标? [英] Kendo UI Tooltip on show, access target?

查看:228
本文介绍了Kendo UI Tooltip on show,访问目标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过将参数 e 传递给内容的匿名函数,可以访问目标。

The target is accessible by passing the argument e to the anonymous function for content.

gridToolTipz = $('#grid').kendoTooltip({ 
    filter: "td[role=gridcell]",
    content: function (e) {
            var target = e.target; // the element for which the tooltip is shown
            ...
    },
    show: function(e) {
            var target = e.target; // the element for which the tooltip is shown
            ...
    }
});

是否有可能在展会上实现同样的目标?上面的代码不起作用。

Is it possible to achieve the same thing on show? The above code doesn't work.

推荐答案

你总是可以通过调用 tooltip.target()

var toolTip = $('#grid').kendoTooltip({
    filter: "td[role=gridcell]",
    content: function (e) {
        var target = e.target; // the element for which the tooltip is currently shown
        return "Content is: " + target.text(); // use current element for content
    },
    show: function (e) {
        var target = this.target(); // the element for which the tooltip is currently  shown

        if (target) {           
            console.log("now showing with content: ");
            console.log(target.text());
        }
    }
}).data("kendoTooltip");

参见演示: http://jsfiddle.net/lhoeppner/mcpxj/

这篇关于Kendo UI Tooltip on show,访问目标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆