簡體   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