简体   繁体   English

jQuery FullCalendar事件

[英]Jquery FullCalendar Events

I would like to put my JSON data (which I succesfully get) into events in FullCalendar Plugin, but unfortunetly It doesnt work for me... 我想将我的JSON数据(成功获取)放入FullCalendar插件的事件中,但不幸的是,它对我不起作用...

    $('#calendar').fullCalendar({
        events: function (start, end, timezone, callback) {
            $.getJSON("http://localhost:3000/test/2014-09-09", function (data, stat) {
                alert(data[0].dates[0].dateStart)
start:data[0].dates[0].dateStart
            });
        }
    });

I had same thing in my previous project something like this. 我在上一个项目中也有类似的事情。 I was also getting data in JSON format. 我还以JSON格式获取数据。

I loop my JSON data and them on fullCalendar as below 我如下循环我的JSON数据和它们在fullCalendar上

First make function 首先make功能

function Event(_id, _title, _start, _color, _editable, _inspectorID, _complaintID, _productID, _seasonYearID, _inspectionType) {
var newEvent = new Object();

newEvent.id = _id;
newEvent.title = _title;
newEvent.start = _start;
newEvent.color = _color;
newEvent.editable = _editable;
newEvent.allDay = true;
newEvent.durationEditable = false;
/* Custom Properties*/
newEvent.InspectorID = _inspectorID;
return newEvent;
 } 

Then add to the calender this object as below 然后如下所示将其添加到日历中

$('#calendar').fullCalendar('renderEvent', Event(newID, productName, _events.Date, "#" + _events.EventColor, editable, _events.InspectorID));

Hope this will help you. 希望这会帮助你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM