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);
}
},
精彩评论