繁体   English   中英

Fullcalendar addEventSource数组

[英]Fullcalendar addEventSource Array

我想添加一个数组的EventSource。 我在ajax调用上创建了一个String,如下所示:

Public Shared Function Test() As String
        Dim EventArray As New ArrayList

        Dim EventSource As String = "[{"
        EventSource += "title:  'All Day Event',"
        EventSource += "start: '2012-07-01'"
        EventSource += "},"
        EventSource += "{"
        EventSource += "title: 'Long Event',"
        EventSource += "start: '2012-07-25',"
        EventSource += "end: '2012-07-28'"
        EventSource += "},"
        EventSource += "{"
        EventSource += "id: 999,"
        EventSource += "title:  'Repeating Event',"
        EventSource += "start: '2012-07-27 16:00:00',"
        EventSource += "allDay: false"
        EventSource += "},"
        EventSource += "{"
        EventSource += "id: 999,"
        EventSource += "title: 'Repeating Event',"
        EventSource += "start: '2012-08-04 16:00:00',"
        EventSource += "allDay: false"
        EventSource += "},"
        EventSource += "{"
        EventSource += "title: 'Meeting',"
        EventSource += "start: '2012-07-30 10:30:00',"
        EventSource += "allDay: false"
        EventSource += "},"
        EventSource += "{"
        EventSource += "title: 'Lunch',"
        EventSource += "start: '2012-07-30 12:00:00',"
        EventSource += "end: '2012-07-30 14:00:00',"
        EventSource += "allDay: false"
        EventSource += "},"
        EventSource += "{"
        EventSource += "title: 'Birthday Party',"
        EventSource += "start: '2012-07-31 19:00:00',"
        EventSource += "end: '2012-07-31 22:30:00',"
        EventSource += "allDay: false"
        EventSource += "},"
        EventSource += "{"
        EventSource += "title: 'Click for Google',"
        EventSource += "start: '2012-07-28',"
        EventSource += "end: '2012-07-29',"
        EventSource += "url: 'http://google.com/'"
        EventSource += "}]"



        Return EventSource
    End Function

我试图像这样添加数组:

$(document).ready(function() {

    $('#calendar').fullCalendar({
        dayClick: function(date) {
        alert(date);
    },
    editable: true

    });
    $.ajax({
                    type: 'POST',
                    url: 'KalenderEvents.aspx/Test',
                    data: '{}',
                    contentType: 'application/json; charset=utf-8',
                    dataType: 'json',
                    success: function (msg) {
                    var events = msg.d || []
                    $('#calendar').fullCalendar('addEventSource','events:' + events);
                    $('#calendar').fullCalendar('rerenderEvents');
                    }
                });
   });

如果我删除“事件:”,代码将尝试执行JSON Feed ...否则他只是不显示任何内容。 Ajax调用正常执行。

您不需要使用events:addEventSource FullCalendar应该正确接受JSON数组。

暂无
暂无

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

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