I am using FullCalendar http://fullcalendar.io/ to display some events on a web page.
The calendar is created like this
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
allDayDefault: false,
selectable: true,
selectHelper: true,
editable: true,
eventLimit: true, // allow "more" link when too many events
});
Events are created through the renderEvent operation (not json feed) like
$('#calendar').fullCalendar('renderEvent', newEvent, 'stick');
where the newEvent is created like this
newEvent = {
title : 'mytitle',
start : startDate,
allDay: false,
id: eventId,
description: 'my test event'
};
the problem is that events are correctly shown in month view but are not shown in week or day views.
UPDATE
I am using this date format: 2015-02-01T01:00:00
I've create a plunker reproducing your code. The only problem I see in your code is a comma expected in the creation of the event.
So I create the event with a new moment object -which means now.
var startDate = moment();
var eventId = 123;
var newEvent = {
title : 'mytitle',
start : startDate,
allDay: false,
id: eventId, //Is this comma that was missing in your code
description: 'my test event'
};
And I add it with the same code you are doing:
$('#calendar').fullCalendar('renderEvent', newEvent, 'stick');
As you can check in the plunker everything is working fine, so the only problem the code you provide us could have:
eventId
variable is wrong startDate
variable is wrongIn addition, if you take a look at the documentation for render event you are not using the 'stick' variable properly. It should be a boolean. In your code is working because as you can check in line 9229 for version 2.3.1 its compared as expression, so any string (non empty) will be true. You can have more info about this in this answer: https://stackoverflow.com/a/4923684/2686163
So, if you set the third parameter stick as:
... always be resolved as sticky, and added to the stickySource
. But, as commented by @slicedtoad, you should change it to avoid problems in future versions.