English 中文(简体)
refetchEvents in jquery fullCalendar doesn t work in IE
原标题:

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 );
}
问题回答

To make refetchEvents work in IE try this:

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

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

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 !!! :)





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签