d我在剑道网格的一列单元格上使用剑道工具提示,但工具提示的内容为空。 使用chrome调试器时,值已正确设置,但工具提示中没有任何内容。
$("#gri").kendoTooltip({
filter: "span.tooltip",
position: "right",
content: function (e) {
var tooltipHtml;
$.ajax({
url: ".." + appBaseUrl + "api/Infobulle?id=" + $(e.target[0]).attr("id"),
contentType: "application/json",
dataType: "json",
data: {},
type: "GET",
async: false
}).done(function (data) { // data.Result is a JSON object from the server with details for the row
if (!data.HasErrors) {
var result = data.Data;
tooltipHtml = "Identifiant : " + result.identifiant;
} else {
tooltipHtml = "Une erreur est survenue";
}
// set tooltip content here (done callback of the ajax req)
e.sender.content.html(tooltipHtml);
});
}
有什么主意吗?为什么它是空的?
答案 0 :(得分:0)
在telerik论坛上查看开发人员的答案后,我发现您需要执行
content: function(){
var result = "";
$.ajax({url: "https://jsonplaceholder.typicode.com/todos/1", async:false , success: function(response){
result = response.title
}});
return result;
}
直接与e.sender.content.html()
进行更改将无效,相反,我们必须返回该值。我尝试了几种方法:
e.sender.content.html()
都行不通content.url
(唯一的缺点是我仍然不知道如何修改响应,我会显示整个响应)并在dojo中查看我的示例,获取有效示例,将鼠标悬停在第三次尝试上