weixin_33725515 2018-10-11 14:06 采纳率: 0%
浏览 49

剑道工具提示为空

dI use a kendo tooltip on cells of a column of a kendo grid but the content of the tooltip is empty. When I use the chrome debugger, values are correctly set but there is nothing in my tooltip.

    $("#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);
            });
        }

Any idea ? Why it is empty ?

  • 写回答

1条回答 默认 最新

  • weixin_33737774 2018-10-12 02:09
    关注

    After looking at the dev's answer on telerik forums, i found out that you need to do something like

    content: function(){
       var result = "";
       $.ajax({url: "https://jsonplaceholder.typicode.com/todos/1", async:false , success: function(response){
            result = response.title
       }});
       return result;
    }
    

    changing directly with e.sender.content.html() won't work, instead we have to return the value. And i tried several approach :

    1. i tried mimick ajax call with setTimeOut, returning string inside it or using e.sender.content.html() wont work
    2. i tried to use content.url ( the only minus i still don't know how to modify the response, i display the whole response)
    3. the third one i tried to use the dev's answer from here

    AND check my example in dojo for working example, hover over the third try

    评论

报告相同问题?

悬赏问题

  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换