Fullcalendar is not displaying events

淺唱寂寞╮ 提交于 2019-12-11 07:14:51

问题


I have a problem with FullCalendar where it doesn't display my events. I have an idea that the event data might be in the wrong format, but I can't see what should be.

The code below is a simplified version of my code:

jQuery('#cal').fullCalendar({
                defaultView: 'agendaDay',
                axisFormat: 'H', //,'h(:mm)tt',
                timeFormat: {
                    agenda: 'H' //h:mm{ - h:mm}'
                },

                firstHour: 18,
                eventSources: 
                   [{"id":64,"title":"TestUser","start":"2011-03-08T02:00:00.0000000","end":"2011-03-08T04:00:00.0000000","allDay":false},{"id":65,"title":"TestUser","start":"2011-03-07T10:00:00.0000000","end":"2011-03-07T12:00:00.0000000","allDay":false}]
                ,
                eventClick: function (calEvent, jsEvent, view) {
                    jQuery('#divEventTitle').html(calEvent.title);
                    showEvent(calEvent);
                    jQuery('#divEvent').dialog();
                },
                theme: true,
                header: false,
                height: 450
            });

回答1:


When passing event data directly, the property to use is "events" as opposed to "eventSources".

Also, you're telling it to show you "agendaDay" which will only show the current day in an hour by hour view. As today is March 6th, and your events are for March 7th and 8th, they will not show for the initial page load.



来源:https://stackoverflow.com/questions/5211035/fullcalendar-is-not-displaying-events

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