开发者

Fullcalendar - jump to agendaDay from month view when date is picked

开发者 https://www.devze.com 2023-03-28 20:21 出处:网络
I\'m having trouble getting 开发者_如何学Pythonthis functionality to work. I would like for the user to be able to jump to the agendaDay view from the month view after selecting a date. Can anyone sug

I'm having trouble getting 开发者_如何学Pythonthis functionality to work. I would like for the user to be able to jump to the agendaDay view from the month view after selecting a date. Can anyone suggest a way to achieve that functionality?


Use the dayClick event, along with changeView and gotoDate

dayClick: function(date, allDay, jsEvent, view) {
  if(view.name != 'month')
    return;

  $('#calendar').fullCalendar('changeView', 'agendaDay')
                .fullCalendar('gotoDate', date);
},


Just the updated answer for the new versions 2.x.x.

You have to call the methods this way:

$('#calendar').fullCalendar('changeView', 'agendaDay');
$('#calendar').fullCalendar('gotoDate', date);

because chaining for the method calls is not implemented (fullCalendar() call to method returns method response instead of JQuery object).


This works for me

 $("#calendar").fullCalendar({

    dayClick: function(date, jsEvent, view) {

        //alert('Clicked on: ' + date.format());
        //alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
        //alert('Current view: ' + view.name);
        if (view.name != 'month')
            return;

        if (view.name == 'month') {
            $('#calendar').fullCalendar('changeView', 'agendaDay');
            $('#calendar').fullCalendar('gotoDate', date);
        }

    },
0

精彩评论

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