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

Dynamic Tooltip with links in particular Grid column

4 Answers 293 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nirav
Top achievements
Rank 1
Nirav asked on 15 Apr 2013, 10:10 AM
Hi,

I want to display customised tooltip on hover in one of the column in grid.
My requirement is:
I have Person's grid where I am displaying first name, last name, birth date details. There is an another column say "Go To". When user mousehover on that particular column's cells, I want to display tooltip template. In which there will be few links (addresses, emails, phones etc.) with person id.
Based on the person's Id the link in tooltip should be constructed, So clicking on it navigates to person details.

How to do this? I have searched on net but couldn't find exact or nearer example.
Need help.

Thanks,
Nirav

4 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 17 Apr 2013, 11:29 AM
Hi Nirav,

 
Basically you can achieve the desired behavior using the Tooltip show event to get the current row underlying dataItem using Grid API. Then you can pass the dataItem to given template and load the generated template into the Tooltip content. Please check the example below:

<script type="text/javascript">
    $(function () {
        var template = kendo.template($("#toolTipTemplate").html());
        //initialize tooltip to grid tbody with filter cells with given CSS class
         tooltip = $("#grid tbody").kendoTooltip({
             filter: "td.myClass",
             width: 120,
             show: function (e) {
                //get current target row
                var currentRow = this.target().closest("tr");
                var grid = $("#grid").data("kendoGrid");
                //get current row dataItem
                var dataItem = grid.dataItem(currentRow);
 
                //pass the dataItem to the template
                var generatedTemplate = template(dataItem);
                //set the generated template to the content of the tooltip
                this.content.html(generatedTemplate);
            },
        }).data("kendoTooltip");
    })
</script>
 
<script id="toolTipTemplate" type="text/x-kendo-template">
    <span>Units currently in stock: #=UnitsInStock#</span>
</script>


Kind Regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Blake
Top achievements
Rank 2
answered on 16 Oct 2015, 05:36 PM

Hi Vladimir,

 I know this is pretty old, but could you post an example project of this functionality?

 Thanks,

Blake

0
Vladimir Iliev
Telerik team
answered on 19 Oct 2015, 07:55 AM
Hello Blake,

Please check the example below:


Regards,
Vladimir Iliev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Blake
Top achievements
Rank 2
answered on 19 Oct 2015, 02:07 PM
Thank you Vladimir. This was great.
Tags
Grid
Asked by
Nirav
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Blake
Top achievements
Rank 2
Share this question
or