I have a checkbox button that I want to rerender the events onChange. I call the reren开发者_如何学CderEvents function but it doesn't fire the eventRender function that I have specified in the calendar creation script. Calling the render function $('#calendar').fullCalendar('render'); works but then for some reason events events that occupy the same day overlap each other instead of stacking up.
Here is my code, the other initialization parameters have been removed for readability:
$('#calendar').fullCalendar({
eventRender: function(event, element) {
//alert(event.title);
if(event.status == 1) {
//alert(event.title);
if(!$("#accepted").attr("checked"))
return false;
}
else if(event.status == 2) {
if(!$("#rejected").attr("checked"))
return false;
}
else if(event.status == '') {
if(!$("#nostatus").attr("checked"))
return false;
}
}
})
$("#accepted").change(function() {
$('#calendar').fullCalendar('rerenderEvents');
});
$("#rejected").change(function() {
$('#calendar').fullCalendar('render');
});
Instead of returning false in eventRender to hide events I added a class to element that set display:none. This gave the effect I was looking for without the overlapping. I had to call the render function rather than rerenderEvents on the change events since only the render function calls the eventRender where I put the code to handle this.
精彩评论