2010-01-06 34 views
0

有沒有其他人有這個問題?這裏有一些代碼:jQuery中的refetchEvents fullCalendar在IE中不起作用

$(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'); 
} 
+0

你有沒有'refetchEvents'在IE中工作 - 我還沒有 – Reddirt 2013-05-22 14:27:40

回答

0

那麼,當然.... IE瀏覽器和它的緩存...我添加以下內容到獲取請求的事件功能。它增加了一個日期參數,因此獲取URL每個調用更改服務器:

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() 
      }, 
1

爲了refetchEvents在IE瀏覽器試試這個:

setTimeout(function() { $('#calendar').fullCalendar('refetchEvents');},0); 
+0

你在哪裏放置這段代碼?它是在$('#calendar')。fullCalendar'還是在document.ready級別? – Reddirt 2013-05-22 13:58:24

0

我也是在IE 9所面臨的同樣的問題,我怎麼解決的,是我附加一個時間戳從那裏事件獲取源文件,所以如果我的文件是"myserver/get_calendar.php"

我所做的就是'myserver/get_calendar.php?$timestamp'這使得瀏覽器感覺到它的新文件,每次嘗試重新獲取時間事件,所以它實際上發送req使用該頁面而不是從瀏覽器緩存中使用它

對不起,我的英語, 希望這能滿足答案! :)