| Issue 232: | "events" doesn't read from source specified | |
| 1 person starred this issue and may be notified of changes. | Back to list |
<b>Reproduce</b> 1. Set a JSON "events" source 2. Switch to month view 3. Switch to agendaWeek 4. Scroll through weeks 5. "events" isn't triggered <<<< 6. Change an event from agendaWeek 7. "events" is triggered !!!!
Dec 8, 2009
To clarify: #1 above refers to using the ajax method. Obviously if you have a hardcoded array, then your start and end is whatever you put in the array. However, #3 is still valid, it will not refetch events unless you go beyond it's default range. You can test by starting on today's month view, go prev or next month, and it will fire refetch. If you start on today's month view, change to either week or day view, once you go beyond Nov 29 or Jan 9th you will see the refetch method fire.
Dec 9, 2009
Hi Kozefx, I need to force refetch from source at every viewDisplay. This is due to multi user environment, as any web app I don't know if another user have changed any DB record so I need to refetch data. I've tried a lot of methods but none I've found force refetch before render view. viewDisplay event triggers after grid render. Any idea? Thnx in advance to eveyone
Dec 11, 2009
Have you tried attaching the refetch method to viewDisplay? http://arshaw.com/fullcalendar/docs/triggered-actions.php viewDisplay: function(view) Triggered once when the calendar loads and every time the calendar’s view is changed. This includes when the prev or next button is pressed. So add this to your options when you init the calendar: viewDisplay: function(view) { $('yourcalendar').fullCalendar('refetchEvents') } I haven't tested, so there may be some more to it....
Dec 20, 2009
(No comment was entered for this change.)
Status:
Duplicate
Mergedinto: 240 |
|
| ► Sign in to add a comment |
Nicola, I have been working with Full Calendar for a few months now and have a grasp of its behavior: 1. When you initial the calendar [say, $('#calendar').fullCalendar({options])] it will get the events from the "events:" and "eventSources:" options. The range will be based on "start" and "end" dates, defaults to the "month" view range (so for December 2009, start begins with November 29 and end is January 9 as that is the range the dates that can be viewed in the "month" view. 2. If you prefer a different range, then you must define it in the start and end. 3. With the default range, the app will not refresh and request new data (based on the new range, depending on view) until you have gone beyond those dates within the default "range". So in the example above, the calendar refetch method would not fire until you have either navigated to before November 29 or after January 9th in any view (month,week,day). 4. You wills see that, depending on your view, when you are outside of those ranges, the "get" events will only request the range that is in view. So if you are in the week view, it will only request the events within that week (start, end) and in day view start and end are the same date. 5. Best practice, write an ajax call to get an events JSON from your backend based on the default start and end for that view. Like so: $.getJSON("/calendar/loadEvents.do", { start: start.getTime(), end: end.getTime() }, function(calevents) { callback(calevents); } ); Now, whenever the view is outside of the "initially loaded" events, then the app will fire the refetch method and request events within its default view, your response should correspond to that. Hope that helps somewhat. Othwerwise, please post code snippet of your events sources and full calendar init options.