3

How do I remove/destroy an existing tooltip created like:

$(td[role=gridcell]").kendoTooltip({ ... });

For example, to destroy a grid you do the following:

$("#grid").data("kendoGrid").destroy();

How do I check whether the tooltip exists and/or has been destroyed?

jtromans
  • 4,183
  • 6
  • 35
  • 33

1 Answers1

11

While the documentation doesn't list a destroy method for kendoToolTip, it does exist.

I would suggest creating your Tooltip like this instead:

$("#grid").kendoTooltip({
    filter: "td[role=gridcell]",
    content: "My Other ToolTip"
});

Then you can destroy the Tooltip with

$("#grid").data("kendoTooltip").destroy();

If you create it like this:

$("td[role=gridcell]").kendoTooltip({ ... });

it will create a widget for each cell (because your jQuery selector selects all cells!), so when you try do this:

var myTooltip = $("td[role=gridcell]").data("kendoTooltip");
myTooltip.destroy();

it will only return and destroy the widget for the first of the matched elements.

Lars Höppner
  • 18,252
  • 2
  • 45
  • 73
  • at the risk of going off-topic, are you aware of the show method has access to any information about the target? – jtromans Nov 20 '13 at 19:20
  • @jtromans You should probably create another question for this where you show what you're trying to do - I'm not sure what you mean with "any information" and where you're trying to access it. – Lars Höppner Nov 20 '13 at 19:28
  • http://stackoverflow.com/questions/20119044/kendo-ui-tooltip-on-show-access-target Done, please let me know what you think. – jtromans Nov 21 '13 at 10:58