可以通过传递参数来访问目标e到匿名函数获取内容。
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
...
}
});
是否有可能在展会上实现同样的目标?上面的代码不起作用。
您始终可以通过调用来访问目标元素工具提示.target() http://docs.kendoui.com/api/web/tooltip#methods-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/ http://jsfiddle.net/lhoeppner/mcpxj/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)