2011-05-25 24 views
0

我有在网页上工作的JQuery FullCalendar插件。首次加载页面时,我的显示内容默认为月视图。此外,在设置可选:true后,用户可以在月视图中选择日期。此时,如果用户从顶部菜单中选择日视图,我想向用户显示所选日期的日视图(议程日期)。但是,目前显示当天的当日景象。下面是代码:FullCalendar Switch查看

<script language="javascript" type="text/javascript"> 
$(document).ready(function() { 
    $('#calendar').fullCalendar({ 
     selectable: true, 
     unselectAuto: true, 
     firstDay: 1, 
     header: { 
      left: 'prev,next today', 
      center: 'title', 
      right: 'month,agendaWeek,agendaDay' 
     }, 
     events: { 
      url: 'CalendarJSON.aspx', 
      type: 'POST' 
     } 
    }) 
}); 

回答

0

Fullcalendar存储日期设定在与变量的年,月,日的初始化。

// example initialization (calendar is the fullcalendar object) 
calendar.fullCalendar({ 
     selectable: true, 
     selectHelper: true, 
     unselectAuto: false,    
     firstDay:1, 
     defaultView:defaultv, 
     slotMinutes:30, 
     year:selected_year, 
     month:selected_month, 
     date:selected_day, 
... 

您可以在选择处理程序中更改此值。

然后我有,它返回这个值的功能(整个日期)

//calendar is the fullcalendar object 
function check_fc_date(calendar){ 
    date = new Date(calendar.fullCalendar('getDate')); 
    year = date.getFullYear(); 
    month = date.getMonth(); 
    day = date.getDate(); 

    alert(year+" "+month+" "+day); 
}