fullCalendar: Implementing a custom event fetcher using event as function

Posted by Nick-ACNB on Stack Overflow See other posts from Stack Overflow or by Nick-ACNB
Published on 2010-05-28T05:21:43Z Indexed on 2010/05/28 5:31 UTC
Read the original article Hit count: 301

Filed under:

If I specify a json feed, the events are re-fetched everytime and the fetching time shows the item appearing which causes a delay which is undesirable (at least after initial fetch was done). I am using the latest version from gitHub 1.4.6. The lazyFetching property seems to only work when you change views and you previously fetched for example a month and are drilling down to week/day which is unusable since I only use agendaDay.

Here is what I am trying to achieve:

$("#calendar").fullCalendar({
   events: 
      function(start, end, callback) {
         $.getJSON(
                    "/GetEvents", 
                    { start: start.valueOf() }, 
                    function(data, textStatus) {                            
                        $.each(data, function(i, event) {
                            //Goal here is to only add items that aren't already rendered.
                            if ($("#calendar")
                                .fullCalendar('clientEvents', event.id)=="")
                               $("#calendar").fullCalendar('renderEvent', event, true);
                        });                            
                    }
                );

});

The goal is to use the sticky property in the renderEvent method so that on-screen they aren't re-rendered if they we're previously fetched.

I omitted a part where I manually delete those that we're deleted and modify those that we're updated since I am in multi-user settings but you get the point.

My issue is that they are fetched once and added. But once I change day and come back, they don't render even if I used sticky... has anyone gotten this error or did I code anything wrong?

Also, is this a wrong way to go? I will consider any input. :)

Thank you very much.

© Stack Overflow or respective owner

Related posts about fullcalendar