2

我曾经有

$('#calendar').fullCalendar({
    //some properties...
    events: "/Agenda/GetEvents/",
});

它工作正常,我的事件显示正确。现在我想更新组合框选择上的事件(重新获取),所以这就是我所做的更改:

$('#calendar').fullCalendar({
    //some properties...
    events: function (start, end) {
        $.ajax({
            url: '/Agenda/GetEvents/',
            dataType: 'json',
            data: {
                start: Math.round(start.getTime() / 1000),
                end: Math.round(end.getTime() / 1000),
                utilisateur: $("#Utilisateur option:selected").val()
            }
        });
        $('#Calendar').fullCalendar('refetchEvents');
    },
});

/Agenda/GetEvents/ 的 url 被正确调用并返回一个事件,但它不会再显示在日历上。难道我做错了什么?

4

4 回答 4

2

在此处查看文档以获取具有单一来源的事件。

完整日历

很少需要改变。

$('#calendar').fullCalendar({
events: function(start, end, callback) {
    $.ajax({
        url: 'myxmlfeed.php',
        dataType: 'xml',
        data: {
            // our hypothetical feed requires UNIX timestamps
            start: Math.round(start.getTime() / 1000),
            end: Math.round(end.getTime() / 1000)
        },
        success: function(doc) {
            var events = [];
            $(doc).find('event').each(function() {
                events.push({
                    title: $(this).attr('title'),
                    start: $(this).attr('start') // will be parsed
                });
            });
            callback(events);
        }
    });
}

});

于 2013-03-01T17:05:31.783 回答
1

解决方案很难找到,但我在这里找到了一种可行的方法

http://mikesmithdev.com/blog/jquery-full-calendar/

于 2013-03-01T20:11:40.990 回答
0

阅读代码几个小时后,我发现关于 allDay 选项的意外配置。每个事件必须有 allDay=false,像这样:

evts.push({ title: "Teste", start: "2014/01/18 10:30", end: "2014/01/18 13:00", allDay: false });
callback(evts);
于 2014-01-18T05:06:56.447 回答
0

删除回调函数只需从成功块中调用它
$('#calendar').fullCalendar('refetchEvents');

于 2015-03-10T14:08:20.660 回答