Can not addEventSource dynamically
For a visual of this, please go to http://dc37.dawsoncollege.qc.ca/jonathan/fullcalendar.jpg
I am trying to build a page where I see the weekly schedule of student A.
On the left of the schedule, I have in a html table ( Courses ) all the courses of Student A is taking. I click on a course row and then below that table, still on the right of the schedule I see another html table ( Tutors) that can help Student A with said course.
So then I click on Student B ( Tutor ), I would like Student B's weekly schedule to add on top of Student A ( Tutee ). I do get the appropriate info and I do have the new data in calevents:
[{"id":"306","title":"Free Time","start":"2011-04-04 08:00:00","end":"2011-04-04 09:00:00","allDay":false,"color":"#ff4500","textColor":"#FFFFFF"},{"id":"307","title":"Free Time","start":"2011-04-04 14:00:00","end":"2011-04-04 22:00:00","allDay":false,"color":"#ff4500","textColor":"#FFFFFF"},{"id":"308","title":"Free Time","start":"2011-04-05 16:00:00","end":"2011-04-05 22:00:00","allDay":false,"color":"#ff4500","textColor":"#FFFFFF"},{"id":"309","title":"Free Time","start":"2011-04-06 16:00:00","end":"2011-04-06 22:00:00","allDay":false,"color":"#ff4500","textColor":"#FFFFFF"开发者_开发问答},{"id":"310","title":"Free Time","start":"2011-04-07 16:00:00","end":"2011-04-07 22:00:00","allDay":false,"color":"#ff4500","textColor":"#FFFFFF"},{"id":"311","title":"Free Time","start":"2011-04-08 16:00:00","end":"2011-04-08 22:00:00","allDay":false,"color":"#ff4500","textColor":"#FFFFFF"}]
In the end, the schedule never appears on the calendar with the code below.
Subsequently I will want to click on Student C's name and then Student B's schedule removes and then Student C's is overlayed.
$("#tutors tr").live("click", function() {
var student_number = $(this).find(".student_number").html();
alert("student tutor click: " + student_number);
$.ajax({
type: "POST",
url: "get.schedule.php",
data: {
action: 'get',
student_number: student_number,
color: '#ff4500'
},
success:function(calevents){
alert(calevents);
$('#matchCalendar').fullCalendar('addEventSource', calevents);
}
});
});
This is what they did:
{
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
events: [
{
title: 'All Day Event',
start: new Date(y, m, 1)
},
{
title: 'Long Event',
start: new Date(y, m, d-5),
end: new Date(y, m, d-2)
}
]
}
Did you check out the basic usage page?
There is also this documentation for the Event Source object. There are a few ways to specify how it is formatted, but I don't think yours fits the bill... You might need an events array, events function, or update url. Not sure about it though...
精彩评论