0

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

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

3 回答 3

1

要使 refetchEvents 在 IE 中工作,请尝试以下操作:

setTimeout(function() { $('#calendar').fullCalendar('refetchEvents');},0);
于 2011-05-24T08:37:35.307 回答
0

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

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

对不起我的英语,希望这能满足答案!:)

于 2012-03-03T11:36:42.183 回答
0

好吧,当然....IE 及其缓存...我将以下内容添加到事件函数的获取请求中。它添加了一个日期参数,因此 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()
            },
于 2010-01-07T01:21:17.060 回答