jquery fullCalendar中的refetchEvents在IE中不起作用

时间:2010-01-06 20:30:34

标签: jquery fullcalendar

还有其他人有这个问题吗?这是一些代码:

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

3 个答案:

答案 0 :(得分:1)

要使refetchEvents在IE中运行,请尝试以下方法:

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

答案 1 :(得分:0)

嗯,当然...... IE及其缓存......我在事件函数的get请求中添加了以下内容。它添加了一个日期参数,因此GET 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()
            },

答案 2 :(得分:0)

我在IE 9中也遇到了同样的问题,我是如何解决这个问题的,我将时间戳附加到源文件中,从中获取事件,如果我的文件是"myserver/get_calendar.php"

我所做的只是'myserver/get_calendar.php?$timestamp'这使浏览器每次尝试重新获取事件时都会感觉到它的新文件,因此它实际上向该页面发送请求而不是从浏览器缓存中使用它

抱歉我的英文, 希望这能满足答案!!! :)