Reputation: 731
I am using the jQuery FullCalendar control to bind JSON results from a Web API call. It bind successfully in the month view, and navigating through the months also works fine.
The problem comes when I try to switch to the week view. I have included the code in the "viewRender" section, though I'm afraid I have gone of course somehow. When the 'appendWeek' view is called, I can see that the Web API is hit, and is returning data back from the AJAX call. Using developer tools, I can see the JSON data that I expect, but it's just not binding to the page.
$('#calendar').fullCalendar({
header: {...},
eventSources: [
{
url: 'http://localhost:61120/api/CalendarApi',
type: 'GET',
data: function () {
return {
group: $("#Group").val(),
startDate: $("#StartDate").val(),
endDate: $("#EndDate").val()
}
}
}
],
eventRender: function (event, element) {
element.find('.fc-title').append(event.EventNumber);
}
, viewRender: function (view, element) {
if (view.name == 'agendaWeek') {
$.ajax({
url: 'http://localhost:61120/api/CalendarApi?group=' + $("#Group").val() + '&startDate=' + $("#StartDate").val() + '&endDate=' + $("#EndDate").val(),
type: 'GET',
success: function (d) {
$('#calendar').fullCalendar('refetchEvents');
}
});
}
}
});
What should I be doing differently to get the week view to display correctly?
Upvotes: 0
Views: 498
Reputation: 731
I fixed my issue, though it was not a problem with the binding at all. I had changed the styles to make the month view look the way I wanted to, including this line:
element.find('.fc-time').hide();
This line had the side effect of hiding the entry on the week view. So the date was there, it was just hidden. One of those days...
Upvotes: 1