FullCalendar 上仅显示第一个事件。我不明白为什么我不能显示多个事件

Only the first event is displayed on the FullCalendar. I cannot figure out why I cannot display more than one event

我只能在 FullCalendar 上显示第一个事件。数据来自 SQL 服务器中的数据库,使用 Entity Framework 中的模型。然后我向视图返回了一个 JSON 对象。有人可以指出正确的方向以便我可以显示数据库中的所有事件吗?

日历视图

      <!DOCTYPE html>

     @{
          Layout = null;

      }

    <html>
    <head>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.min.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.min.js"></script>




    <style type="text/css">

    body {
        margin: 0;
        padding: 0;
        font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
        font-size: 14px;
    }

    #top {
        background: #eee;
        border-bottom: 1px solid #ddd;
        padding: 0 10px;
        line-height: 40px;
        font-size: 12px;
    }

    #calendar {
        max-width: 900px;
        margin: 40px auto;
        padding: 0 10px;
    }
    </style>


    <script type="text/javascript">



    /*Get data from the database and load it on the FullCalendar*/
    $(window).load(function () {

        jQuery(document).ready(function ($) {

            var events = [];
            $.ajax({
                type: "GET",
                url: "@Url.Action("GetEvents", "Calendar")",  //Get the data
                contentType: "application/json",
                success: function (data) {
                    $.each(data, function (i, v) {

                        events.push({
                            title: v.ProjectName,
                            start: moment(v.DateCreated),


                        });


                        GenerateCalendar(events);  
                    })


                },
                        error: function (error)
                        {
                            alert('Error');
                        }

            });


            function GenerateCalendar(events) {

                $('#calendar').fullCalendar({
                    height: 666,
                    nowIndicator: true,
                    defaultView: 'agendaWeek',
                    columnHeaderFormat: 'ddd D MMM',
                    header: {
                        left: 'prev,next today',
                        center: 'title',
                        right: 'month,agendaWeek,agendaDay'
                    },

                    defaultView: 'month',                       
                    selectable: true,
                    editable: false,
                    events: events  //This allows the calendar to display only the first event.


                });

            }


        });

    });



 </script>

 </head>
 <body>


<div id="calendar"></div>


 </body>
 </html>

日历控制器

   public JsonResult GetEvents()
   {


        using (FacilityRequestEntities db = new FacilityRequestEntities())
        {
            var events = db.Dashboards.ToList();
            return new JsonResult { Data = events, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
        }

   }

数据库table、SQL服务器

   FaspNumberId Projectname CurrentStatus DateCreated       RequestorName        
   001          AAA         Approved      2018-11-30 01:40:00     John 
   002          BBB         Pending       2018-12-01 01:16:00     Eric 
   003          CCC         Approved      2018-12-01 03:46:00     Marie  
   004          DDD         Disapproved   2018-12-02 05:52:00     Anne                            

通过对我的 CalendarView 进行一些更改,我能够找出问题所在。请参阅以下解决方案:

 <!DOCTYPE html>

 @{
     Layout = null;

 }


 <html>
 <head>

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
 <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"></script>
 <link href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.min.css" rel="stylesheet" />
 <script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.min.js"></script>



 <style type="text/css">

    body {
        margin: 0;
        padding: 0;
        font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
        font-size: 14px;
    }

    #top {
        background: #eee;
        border-bottom: 1px solid #ddd;
        padding: 0 10px;
        line-height: 40px;
        font-size: 12px;
    }

    #calendar {
        max-width: 900px;
        margin: 40px auto;
        padding: 0 10px;
    }
 </style>


 <script type="text/javascript">

    $(window).load(function () {


        $(document).ready(function() {

             // Fetch our events
            $.ajax({
                url: "@Url.Action("GetEvents", "Calendar")",  //Get the data from the controller,
                method: "GET",
                datatype: "json",

            }).done(function (data) {
                // Parse our events into an object called events that will later be used to initialize FullCalendar
                var events = [];

                $.each(data, function (i, v) {

                    events.push({
                        title: v.ProjectName,
                        start: moment(v.DateCreated),
                    });
                });

                $('#calendar').fullCalendar({

                     height: 666,
                    nowIndicator: true,
                    defaultView: 'agendaWeek',
                    columnHeaderFormat: 'ddd D MMM',
                    header: {
                        left: 'prev,next today',
                        center: 'title',
                        right: 'month,agendaWeek,agendaDay'
                    },

                    defaultView: 'month',
                    selectable: true,
                    editable: false,
                    events: events,  //Pass the new collection of events to the FullCalendar initialization function, targeting the #calendar div.
                });
            });


        });

    });



 </script>

 </head>
 <body>


 <div id="calendar"></div>


 </body>
 </html>