문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top