开发者

Change view and show the view of the selected day

开发者 https://www.devze.com 2023-03-16 02:23 出处:网络
I\'m new in fullcalendar; I set a calendar that by default shows a month view and it also has the button for the agendaDayview and agendaWeekView; so what I want is: when a user selects one day (examp

I'm new in fullcalendar; I set a calendar that by default shows a month view and it also has the button for the agendaDayview and agendaWeekView; so what I want is: when a user selects one day (example in month view 06/29) then change the view to week the week must have the selected day or if selects day view display the selected day.

Fullcalendar by default show the week that ha开发者_运维技巧s the current date or the current day when the view change.

Arturo



You can add the following as part of your dayClick callback:

dayClick: function(date, allDay, jsEvent, view) {
    $('#calendar').fullCalendar('gotoDate', date);
}

This takes the current date that's passed from the click and sends the calendar to that specific date. This takes the selected date, from any view, and applies it to all the other views.

If you clicked on 06/29 in the month view and then went to the week view, you'd be taken to the week in which 06/29 was in. If you changed the week you were in and selected 07/01 and then went back to the month view, you'd see the data July. Hope that makes sense!


This works in FullCalendar v1.6.4

            select: function(start, end, allDay)
            {                       
                $('#calendar').fullCalendar('gotoDate', start);
                $('#calendar').fullCalendar('changeView', 'agendaDay'); 
            },
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号