简体   繁体   English

完整日历eventDrop触发事件在Firefox 15中点击

[英]Full Calendar eventDrop firing eventClick in Firefox 15

I don't know what exactly to change about the following code to make it work in Firefox 15: 我不知道要在Firefox 15中使用以下代码到底有什么变化:

    eventDrop: function (event, dayDelta) {
        updateCalendarEvent(event.id, dayDelta);
        //Firefox 15 fires eventClick for no good reason???
    },
    eventClick: function (event) {
        alert('event click');
        if (event.url) {
            alert(event.url);
            vUrl = '../Activities/' + event.url;
            openActivityAddEditDialog(vUrl, 'Edit Activity');
            return false;
        }
    },

I have done a fair bit of research and this is definitely a BUG. 我做了一些研究,这肯定是一个BUG。 Code works fine in Chrome, Safari, Firefox 14 & even IE - but not Firefox 15. It's been almost 2 months and no fix is in sight. 代码在Chrome,Safari,Firefox 14甚至IE中运行良好 - 但不适用于Firefox 15.已经差不多2个月了,看不到修复。

Someone posted this about a work-around hack here: http://code.google.com/p/fullcalendar/issues/detail?id=1523 有人在这里发布了关于解决方法的问题: http//code.google.com/p/fullcalendar/issues/detail? id = 1523

Another similar unanswered Full Calendar Firefox SO question: Full Calendar event hyperlinks automatically fire in Firefox 另一个类似的未答复的完整日历Firefox SO问题: 完整日历事件超链接在Firefox中自动触发

You will also have some event data like this: 你还会有一些这样的事件数据:

events: [

{id: '76',title: 'Hot Shave',data: 'Some data',start: new Date(2012,9, 17, 13 , 55),end: new     Date(2012,9,17, 13 , 115),allDay: false, url: '<someurl>'}
],

Change the event where it says "url:" to "workingurl:" and update your eventclick code to be: 将名为“url:”的事件更改为“workingurl:”,并将您的eventclick代码更新为:

eventClick: function (event) {
        alert('event click');
        if (event.workingurl) {
            alert(event.workingurl);
            vUrl = '../Activities/' + event.workingurl;
            openActivityAddEditDialog(vUrl, 'Edit Activity');
            return false;
         }
    },

That should stop FF firing off the click based on the url: property which then no longer exists. 这应该停止FF基于url:属性触发点击,该属性不再存在。

When you include the 'url' attribute in your event JSON FullCalendar will render the event as an an <a> link rather than a <div> . 当您在事件中包含'url'属性时,JSON FullCalendar会将事件呈现为<a>链接而不是<div>

It looks like Firefox is treating the drag and drop of the <a> as a click and following the URL. 看起来Firefox正在将<a>的拖放视为点击并跟随URL。 This results in the AJAX request getting interrupted and returning status=0 as documented here: https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest?redirectlocale=en-US&redirectslug=Using_XMLHttpRequest#XMLHttpRequests_being_stopped 这导致AJAX请求被中断并返回status=0如下所示: https//developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest?redlocale status=0 en-US&redctsctslug status=0 Using_XMLHttpRequest#XMLHttpRequests_being_stopped

In my case (Firefox 18) this is resulting in a "You are offline! Please check your network" warning message. 在我的情况下(Firefox 18),这导致“您正在离线!请检查您的网络”警告消息。

Renaming the 'url' attribute to 'targetUrl' causes the event to be rendered as a <div> solving the problem. 将'url'属性重命名为'targetUrl'会导致事件呈现为解决问题的<div> You then need to modify your eventClick handler to use the new attribute accordingly. 然后,您需要修改eventClick处理程序以相应地使用新属性。

Even after putting breakpoints for all functions in fullcalendar.js - the error still happens and no full calendar functions are getting fired after eventDrop completes - but the re-direct still happens. 即使在fullcalendar.js中为所有函数设置了断点之后 - 错误仍然发生,并且在eventDrop完成后没有完整的日历函数被触发 - 但是仍然会发生重定向。

ONLY IN FIREFOX 15! 仅限FIREFOX 15!

Also changed to earlier versions of jquery - but no difference. 也改为早期版本的jquery - 但没有区别。

I have seen some recent posts about Firefox 15 and drop event bugs, but nothing applies to this specifically. 我已经看到一些关于Firefox 15的最新帖子和丢弃事件错误,但没有什么特别适用于此。

Is anyone out there having this problem? 有没有人有这个问题?

If not - is there a way to only disable drag & drop for Firefox users? 如果没有 - 有没有办法只为Firefox用户禁用拖放功能?

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

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