FullCalendar showing event in month view but not day and week view?

落爺英雄遲暮 提交于 2019-12-22 08:36:42

问题


I'm working with FullCalendar fetching events from a json feed. However, I've run into a problem.

The calendar shows my event just fine in the month view, but when going to the day/week in day-view and week-view, the even is not shown?

My initialization of fullcalendar looks like this:

var options = {
    header: {
        left: 'prev, next',
        center: 'title',
        right: 'month,agendaWeek,agendaDay'
    },
    allDaySlot: false,


    monthNames: ["Januar","Februar","Marts","April","Maj","Juni","Juli", "August", "September", "Oktober", "November", "December" ], 
    monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Okt','Nov','Dec'],
    dayNames: ['Søndag',  'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'],
    dayNamesShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'],
    buttonText: {
        today: 'I dag',
        month: 'Måned',
        week: 'Uge',
        day: 'Dag'
    },
    weekends: false,

    defaultView: 'agendaWeek',
    events: '/feed/',

    firstHour: 8,
    slotMinutes: 20,
    defaultEventMinutes: 120,
    axisFormat: 'HH:mm',
    timeFormat: {
        agenda: 'H:mm{ - h:mm}'
    },
    minTime: 8,
    maxTime: 16
};

$('#calendar-holder').fullCalendar(options);

My feed returns the following json:

[{"id":"7","title":"Elias  (10:00)","start":1359108000,"end":1359109800,"url":"\/tidsbestillinger\/edit\/"}]

Any ideas why this is happening?


回答1:


Solved! Had to set

allDayDefault: false, 

while initializing FullCalendar.

Alternatively I could have set

allDay = false

in the JSON - but doing it globally is much easier.




回答2:


Also make sure that event length must be enough that it can be displayed in slotDuration. e.g. my slotDuration is 15 minutes, my event only displayed if it has minimum 2 minutes duration.



来源:https://stackoverflow.com/questions/14424916/fullcalendar-showing-event-in-month-view-but-not-day-and-week-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!