This is a migrated thread and some comments may be shown as answers.

How to use custom content to show the grid's tooltip?

1 Answer 306 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ABC
Top achievements
Rank 1
ABC asked on 17 Apr 2013, 07:07 PM
How to use custom content to show the grid's tooltip? I want to show the tooltio ofcoloumn 2 and coloumn 3 ,and the content is  a span which id called spanid or div which is called divid?
               

    var tooltip = $("#Grid").kendoTooltip({
            filter: "td",
            width: 120,
            position: "top",
            content: value
        }).data("kendoTooltip");

I try to write this,but it seems wrong.

    var tooltip = $("#Grid").kendoTooltip({
            filter: "td[3n]||td[2n]",
            width: 120,
            position: "top",
            content: divid.html()
        }).data("kendoTooltip");

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 19 Apr 2013, 08:48 AM
Hello,

Your scenario will require complicated jQuery filter selector. In order to simplify it, I recommend you to attach a class attribute to the columns on which the tooltip should be applied. As an example:
{
    field: "foo",
    template:  '#= foo# <p class="tooltipcontent" style="display:none">sample content</p>',
    attributes: { "class": "hasTooltip" }
}

The filter:
$("#grid").kendoTooltip({
    filter: ".k-grid-content td.hasTooltip",
    content: function (e) {
      var container = e.target.parent();
      return container.find(".tooltipcontent").html();
    }
});

In order to retrieve the content of the tooltip, please use the content function.
I hope this information will help. For your convenience I prepared a small example: http://jsbin.com/ulonan/2/edit

Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
ABC
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or