2014-12-04 1 views
0

최신 Fullcalendar 버전 (2.2.3)을 사용하도록 앱을 업데이트하고 있습니다. 나는 1.6.4를 사용하고 있었다.Fullcalendar를 2.2.3으로 업데이트 한 후 런타임 오류가 발생했습니다.

현재 버전으로 업데이트하면 fullcalendar가 이벤트 데이터 검색을 준비 할 때 런타임 오류가 발생합니다. 아래 함수에 도달하면 rangeStart 및 rangeEnd 변수는 null이고 .clone() 메서드가 적용될 때 null 참조가 생성됩니다. 다음은 오류가 발생한 fullcalendar.js (줄 1401에서 시작) 함수입니다. 여기

function _fetchEventSource(source, callback) { 
    var i; 
    var fetchers = fc.sourceFetchers; 
    var res; 

    for (i=0; i<fetchers.length; i++) { 
     res = fetchers[i].call(
      t, // this, the Calendar object 
      source, 
      rangeStart.clone(), <== rangeStart is null and causes null reference error here 
      rangeEnd.clone(), 
      options.timezone, 
      callback 
     ); 

     if (res === true) { 
      // the fetcher is in charge. made its own async request 
      return; 
     } 
     else if (typeof res == 'object') { 
      // the fetcher returned a new source. process it 
      _fetchEventSource(res, callback); 
      return; 
     } 
    } 

달력 개체를 내보기

 $('#calendar').fullCalendar({ 
     editable: false, 
     eventSources: [ 
      { 
       url: '@Url.Action("PullCalendarEvents")', 
       type: 'POST', 
       error: function() { 
        //alert('there was an error while fetching events!'); 
        presentErrorPopup('fetch'); 
       } 
      } 
     ] 
    }); 

달력이 탭에 정의하는 방법이다. 탭을 선택하면 달력을 표시하기 위해 호출되는 선입니다.

 $('#calendar').fullCalendar('refetchEvents') 

일정 개체를 정의하거나 호출하는 방식을 변경해야합니까?

+1

이것은 순수한 JavaScript이며 C#과 아무 관련이 없습니다. 그에 따라 태그를 업데이트했습니다. – PoweredByOrange

+0

사실 코드는 JavaScript이지만 C# 응용 프로그램 내에서 사용하고 있습니다. 그걸 준거야? – mcolegro

+0

아니, 나는 downvote하지 않았다. 태그를 편집했습니다. – PoweredByOrange

답변

0

뷰에서 .fullCalendar에 대한 참조 순서를 변경하여이 문제를 해결했습니다. 버전 1.6.4에서는 순서가 중요하지 않지만 버전 2.2.3에서는 그 순서가 마음에 들지 않았습니다. (축소 된 경우 또는 "A가 null") :

var reloadCalendar = function() 
{ 
    $('#calendar').fullCalendar('refetchEvents'); 
} 

(function() 
{ 
... 
})(); 

에러 없음 : 내 경우 놓친 세미콜론에서

  $('#calendar').fullCalendar({ 
      editable: false, 
      eventSources: [ 
      { 
       url: '@Url.Action("PullCalendarEvents")', 
       type: 'POST', 
       error: function() { 
        //alert('there was an error while fetching events!'); 
        presentErrorPopup('fetch'); 
       } 
      } 
     ] 
    }); 

//Moving this section to be below the above code resolved the error 
    $(function() { 
     $("#tabs").tabs({ 
      show: function (event, ui) { 
       $('#calendar').fullCalendar('render'); 
      } 
     }) 
    }); 
0

는 이유

"하는 rangeStart가 null 유형 오류"이었다 :

var reloadCalendar = function() 
{ 
    $('#calendar').fullCalendar('refetchEvents'); 
}; 

(function() 
{ 
... 
})(); 

이것은 도움이됩니다.

관련 문제