繁体   English   中英

jQuery FullCalendar事件

[英]Jquery FullCalendar Events

我想将我的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
            });
        }
    });

我在上一个项目中也有类似的事情。 我还以JSON格式获取数据。

我如下循环我的JSON数据和它们在fullCalendar上

首先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;
 } 

然后如下所示将其添加到日历中

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

希望这会帮助你。

暂无
暂无

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

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