Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Duplicate events with fullcalendar function-generated events

Using fullcalendar, I'm generating Event Objects from an XML feed using the events function.

Problem

In the month view, each event appears on the calendar twice (two <td>s per event in the feed). two table details calendar grid

What I've Tried

  • I've literally started over by copying the example from the page, modifying it only to use my real XML feed:

    $("#calendar").fullCalendar({
         events: function(start, end, timezone, callback) {
    
            $.ajax({
                url: settings.feedURI,
                dataType: "xml",
                success: function(doc) {
                    var events = [];
                    $(doc).find("buyout").each(function() {
                        events.push({
                            title: $(this).find("title").text(),
                            start: $(this).find("date").text() + "T" + $(this).find("startTime").text() + ":00Z",
                        });
                    });
                    callback(events);
                }
            });             
         }
    
    });
    
  • At first glance, it appears that the problem can be "solved" by removing the <td>s that have a class: $(".fc-event-container").remove(). Obviously, this is crufty and I have no idea what impact this could have in the future, so I'd prefer to not generate the duplicates to begin with. Plus, the duplicates re-appear as soon as one switches from month view to day or week.

  • I've been through virtually all of the documentation and everything I can find here on SO.
  • I've triple-checked the feed to be sure it contains no duplicate elements. Here's its structure: feed structure

Thanks so much!

like image 816
James Baker Avatar asked Jan 29 '26 01:01

James Baker


1 Answers

The solution to the problem turned out to be upgrading from jQuery 1.12 (recommended at jquery.org if you need to support IE8) to jQuery 2.1.3. To discover this requirement, I had to look at the plugin author's JSBin link on the Support page or open the jquery.min.js file that came with the download to see the version number in the comments. So far as I have seen, there is no mention on fullcalendar.io pages of this dependency or of the fact that the calendar isn't suitable for those still supporting IE8.

like image 186
James Baker Avatar answered Jan 30 '26 13:01

James Baker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!