Reputation: 196
Has anyone else had this problem? Here is some code:
$(document).ready(function() {
$('#calendar').fullCalendar({
editable: true,
disableDragging: false,
height: 400,
weekMode: 'variable',
defaultView: 'agendaDay',
allDaySlot: false,
weekends: false,
minTime: 7,
maxTime: 22,
slotMinutes: 15,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
eventSources: [
//US HOLIDAYS
//TODO: Add entries for Alaska Day and Seward Day
$.fullCalendar.gcalFeed('http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic')
],
events: function(start, end, callback) {
$.getJSON('<%= ResolveUrl("~/TimeSheet/fetchCalEvents") %>',
{
start: $.fullCalendar.formatDate(start, "yyyy-MM-dd HH:mm:ss"),
end: $.fullCalendar.formatDate(end, "yyyy-MM-dd HH:mm:ss")
},
function(data) {
if (data != null) {
var events = [];
$.each(data, function(i, data) {
//allDay = start.indexOf('T') == -1;
//if (allDay) {
//$.fullCalendar.addDays(end, -1); // make inclusive
//}
events.push({
id: data.ID,
title: data.TITLE,
start: new Date(parseInt(data.START.replace("/Date(", "").replace(")/", ""), 10)),
end: new Date(parseInt(data.END.replace("/Date(", "").replace(")/", ""), 10)),
allDay: false,
//location: entry['gd$where'][0]['valueString'],
//description: entry['content']['$t'],
//className: options.classN6ame,
editable: true
});
});
callback(events);
} //END if (data != null)
});
},//........ lots more code here.
//MY FORM HEADER USED WHEN SUBMITTING A NEW CALENDAR ITEM TO THE DB:
<% using (Ajax.BeginForm("newTimeEntry", "TimeSheet", new AjaxOptions() { UpdateTargetId = "newTimeEntry", OnComplete="timeSubmitComplete", OnSuccess = "enableTimePickers", InsertionMode = InsertionMode.Replace }, new { id = "TimeEntry" }))
//##########################################
//CALLED AFTER SUCCESSFUL TIME ENTRY SUBMISSION
//RELOADS THE CALENDAR EVENTS
function timeSubmitComplete() {
$('#calendar').fullCalendar('refetchEvents');
}
Upvotes: 0
Views: 5356
Reputation: 454
I also faced the same problem in IE 9, how i solved it was i appended an timestamp to the source file from where events were fetched so if my file was "myserver/get_calendar.php"
all i did was 'myserver/get_calendar.php?$timestamp'
this makes the browser feel its new file every time it tries to re fetch the event so it actually sends request to that page instead of using it from browser cache
sorry for my English, Hope this satisfies the answer !!! :)
Upvotes: 0
Reputation: 11
To make refetchEvents work in IE try this:
setTimeout(function() { $('#calendar').fullCalendar('refetchEvents');},0);
Upvotes: 1
Reputation: 196
Well, of course....IE and its caching... I added the following to the get request for the events function. It adds a date parameter so the GET url changes each and every call to the server:
events: function(start, end, callback) {
$.getJSON('<%= ResolveUrl("~/TimeSheet/fetchCalEvents") %>',
{
start: $.fullCalendar.formatDate(start, "yyyy-MM-dd HH:mm:ss"),
end: $.fullCalendar.formatDate(end, "yyyy-MM-dd HH:mm:ss"),
noCache: new Date()
},
Upvotes: 0