jquery contextMenu hide/show 事件未被触发

jquery contextMenu hide/show event not being triggered

我的显示和隐藏事件不会被触发,除非我在方法中放置了一个 alert() 或我在 Chrome 函数中的开发者工具中有一个断点。

我不想显示警报。我可能会错过什么? 谢谢!

这是我的 JQuery contextMenu 对象(具有警报功能):

$.contextMenu({
            selector: 'circle',
            trigger: 'left',
            events: {
                show: function(options) {
                    contextMenuIsOpen = true;
                    if ($("#GraphType option:selected").text() == "Line")
                        chart = "#chart";

                    $(chart).data("kendoChart").options.tooltip.visible = false;
                    alert("Show Context Menu");
                },
                hide: function (options) {
                    contextMenuIsOpen = false;
                    $(chart).data("kendo-chart").options.tooltip.visible = true;
                    alert("Hide Context Menu");
                }
            },
            build: function () {
                return buildMenu();
            }
        });

感谢 ChrisG、ibrahim mahrir 和 NigelK 的建议,我能够确定这不是 jQuery 上下文菜单问题,而是 kendo 图表问题。

我没有使用 $(chart).data("kendo-chart").options.tooltip.visible 将工具提示可见性设置为 true 或 false,而是使用 $(chart).data("kendo-chart").setOptions({ tooltip: { visible: false } } );

我希望这个回答可以帮助到自己遇到此问题的任何人。

非常感谢您的帮助。 Whosebug 拥有最优秀的人才!