简体   繁体   English

jquery contextMenu 隐藏/显示事件未被触发

[英]jquery contextMenu hide/show event not being triggered

My show and hide events are not triggered unless I place an alert() inside the method or I have a breakpoint in Chrome Developer Tools inside the function.我的显示和隐藏事件不会被触发,除非我在方法中放置了一个 alert() 或者我在函数内部的 Chrome 开发者工具中有一个断点。

I do not want an alert to show.我不想显示警报。 What could I be missing?我可能会错过什么? Thanks!谢谢!

Here is my JQuery contextMenu object (with alert functions):这是我的 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();
            }
        });

Thanks to ChrisG, ibrahim mahrir and NigelK suggestions, I was able to figure out that this was not a jQuery contextMenu issue but a kendo chart issue.感谢 ChrisG、ibrahim mahrir 和 NigelK 的建议,我能够弄清楚这不是 jQuery contextMenu 问题,而是剑道图表问题。

Instead of using $(chart).data("kendo-chart").options.tooltip.visible to set the tooltip visibility to true or false, I am instead using $(chart).data("kendo-chart").setOptions({ tooltip: { visible: false } } );我没有使用$(chart).data("kendo-chart").options.tooltip.visible将工具提示可见性设置为 true 或 false,而是使用$(chart).data("kendo-chart").setOptions({ tooltip: { visible: false } } );

I hope this answer can help anyone who comes across this issue themselves.我希望这个答案可以帮助任何遇到这个问题的人。

Thank you so much for your help.非常感谢你的帮助。 StackOverflow has the best people! StackOverflow 拥有最优秀的人才!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM