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

Determining which element lanched the tooltip?

3 Answers 63 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Brian Roth
Top achievements
Rank 1
Brian Roth asked on 06 Mar 2013, 11:12 PM
I'm playing around with the new tooltip and so far so good!  I've run into one problem though, which might just be because the documentation has not been published yet.  I have a situation where I am showing a tooltip when the user hovers over a grid cell.  In the tooltip I have a button where if the user clicks that button I want to do something to the data in the grid for the selected row.  My plan was to bind the click event of the button from inside the tooltip's ContentLoad event .  But I can't figure out in ContentLoad if there's a way to determine what element caused the tooltip to display.  Is there a way to do this?  I'd like to be able to get the <td> of the grid cell, and traverse that up to the <tr> so that I can use that to retrieve the grid's data item.

Thanks,
Brian

3 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 07 Mar 2013, 03:11 PM
Hi Brian,

You may configure the content as a function in order to build the Tooltip content and to attach the click handler. Here is a test page which illustrates a basic implementation.

Greetings,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Brian Roth
Top achievements
Rank 1
answered on 07 Mar 2013, 03:36 PM
Hi Rosen,

Thanks for the advice.  I'm actually using the MVC wrapper Tooltip with a LoadContentFrom to get my content from another view.  How would this approach work in that situation?  Or would I need to take another approach?

Brian
0
Brian Roth
Top achievements
Rank 1
answered on 07 Mar 2013, 03:55 PM
Never mind.  I figured out another way to do it.  In the RequestStart event, I save the value of e.target to a global variable and then in the ContentLoad event I access that variable and set up the click event.  Seems to be working just dandy now.  Thanks!

Brian
Tags
ToolTip
Asked by
Brian Roth
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Brian Roth
Top achievements
Rank 1
Share this question
or