0

我每天都有一个使用自定义类实现的简单 KendoUI 日历小部件,点击它会显示 kendoUI 工具提示

                $("#calendar").kendoCalendar({
                    month: {
                        // template for dates in month view
                        content: '<div class="tool_tip">#=data.value#</div>'
                    },
                    footer: false
                });


                $(".tool_tip").kendoTooltip({
                    autoHide: false,
                    showOn: "click",
                    position: "top",
                    content: 'Hello'
                });

出于某种奇怪的原因,它只会显示当月每一天的点击工具提示。如果我要更改月份,工具提示将不再显示。另请注意,“工具提示”类也被注入到该月的所有其他日子。

感谢您的阅读。

4

1 回答 1

1

The problem is with the way that you set the tooltip. Since this is initialized when the Calendar is created but not refreshed when you navigate. Elements created after navigating do not have the tooltip associated to it.

You should do:

    $(document).ready(function () {
        $("#calendar").kendoCalendar({
            month: {
                // template for dates in month view
                content: '<div class="tool_tip">#=data.value#</div>'
            },
            footer: false,
            navigate : function () {
                $(".tool_tip").kendoTooltip({
                    autoHide: false,
                    showOn: "click",
                    position: "top",
                    content: 'Hello'
                });
            }
        });
    });

Check it running here: http://jsfiddle.net/OnaBai/kvbse/

于 2013-06-27T21:19:14.290 回答