2010-02-08 2 views
2

사용자가 '다음'(화살표)을 클릭하면 어떻게 알림을받을 수 있습니까? 월별보기에서 캘린더를 사용하고 있으며 요청에 따라 다음 달 데이터를로드하려고합니다. 또한 smbdy는 ASP.NET (AJAX 호출)에서 데이터를 사용하는 예가 있습니까?jQuery FullCalendar '다음'이벤트 notificatin을 클릭하십시오

+0

은 (http://stackoverflow.com/questions/12278295/jquery-get-the-next-month-data-using-fullcalendar-plugin를 [fullcalendar 플러그인을 사용하여 다음 달의 데이터를 얻을 수 jQuery를] 내 예를 참조하십시오/19135058 # 19135058) – Ben

답변

3

당신은 viewDisplay 트리거 (http://arshaw.com/fullcalendar/docs/display/viewDisplay/)를 사용할 수 있지만 캘린더가로드되거나 사용자가보기를 전환 할 때도 호출됩니다. asp.net 일에 대한 http://arshaw.com/fullcalendar/docs/event_data/events_function/

, 여기 보았다 : 당신이 이벤트 대신으로 작동 할 것 같은

는 소리? http://weblogs.asp.net/gunnarpeipman/archive/2010/02/03/using-fullcalendar-jquery-component-with-asp-net-mvc.aspx

0

여기에서 사용자가 다음/prev를 클릭하면 viewDisplay 함수가 호출됩니다. 또한 AJAX를 통해 다음 데이터를 많이 확보하고 있음을 알 수 있습니다. 도움이되기를 바랍니다.

$(document).ready(function() { 

var calendar = $('#calendar').fullCalendar({ 
    header: { 
     left: 'prev,next today', 
     center: 'title', 
     right: 'resourceMonth' 
    }, 
    defaultView: 'resourceWeek', 


    eventSources: [ getCalData() ], 
    header: { 
     left: 'prev,next today', 
     center: 'title', 
     right: '' 
    }, 
    viewDisplay: function (view) { 
     $('#calendar').fullCalendar('removeEvents'); 
     $('#calendar').fullCalendar('addEventSource', getCalData()); 
     $('#calendar').fullCalendar('rerenderEvents'); 
    } 
    }); 
}); 


function getCalData() { 

var source = [{}]; 
$.ajax({ 
    async: false, 
    url: '/mysite/GetWeekData', 
    data: { myParam: $('#calendar').fullCalendar('getView').visStart }, 
    success: function (data) { 
     $(data).each(function() { 
      source.push({ 
       title: $(this).attr('title'), 
       start: $(this).attr('start'), 
      }); 
     }); 
    }, 
    error: function() { 
     alert('could not get the data'); 
    }, 
}); 
return source; 
} 
1

접근 방법이 잘못되었습니다. JSON에서 캘린더 개체 목록을 반환하는 API를 작성하고 다음 옵션을 사용해야 할 수도 있습니다.

$('#calendar').fullCalendar({ 
    events: '/myfeed.php' 
}); 

그런 다음 fullcalendar는 필요할 때마다 /myfeed.php를 자동으로 호출합니다. 예 : 사용자가 '이전'또는 '다음'달 버튼을 클릭하면

다음 예제 URL의 fullcalendar이 생성입니다 :

/myfeed.php?start=1262332800&end=1265011200&_=1263178646 

자세한 내용은 다음 URL을 참조하십시오. http://arshaw.com/fullcalendar/docs/event_data/events_json_feed/

관련 문제