首页 > 解决方案 > fullcalendar 在超过 10k 个事件后停止显示事件

问题描述

嗨,我想将 fullcalendar 与数据库一起使用,但一旦我在日历中放入超过 10k 的事件,它就会停止显示事件。有没有办法阻止 fullcalendar 停止显示事件?

下面的版本是 4.0.0
(我用了 3.9.0 和 4.0.0 的 fullcalendar 都不起作用)

<script type="text/javascript">
    document.addEventListener('DOMContentLoaded', function () { // DOMContentLoaded zorgt ervoor dat eerst de html laad
        var calendarEl = document.getElementById('calendar'); // grab element reference

        var calendar = new FullCalendar.Calendar(calendarEl, {
            // put your options and callbacks here
            events: [
                <?php

                include_once('./assets/handlers/DB_Handler.php');

                try {
                    $getCalenderItems = $conn->prepare("SELECT COD.CursusID, O.Onderdeelnaam,
                    CONCAT( REPLACE( DATE_ADD( DATE( CO.DatumBegin ) , INTERVAL -1 MONTH ) ,  '-',  ',' ) ,  ',', HOUR( CO.DatumBegin ) ,  ',', MINUTE( CO.DatumBegin ) ) AS Start,
                    CONCAT( REPLACE( DATE_ADD( DATE( CO.DatumEind ) , INTERVAL -1 MONTH ) ,  '-',  ',' ) ,  ',', HOUR( CO.DatumEind ) ,  ',', MINUTE( CO.DatumEind ) ) AS Eind

                    FROM cursusonderdeeldocenten COD

                    INNER JOIN onderdelen O ON COD.OnderdeelID = O.OnderdeelID
                    INNER JOIN cursusonderdelen CO ON COD.CursusID = CO.CursusID

                    WHERE COD.DocentID = 15
                    AND CO.DatumBegin >=  DATE_ADD(CURDATE(), INTERVAL -8 MONTH)
                    ORDER BY CO.DatumBegin");

                    $getCalenderItems->bindParam(':DocentID', $DiD);

                    // Select docent
                    $DiD = 15;
                    $getCalenderItems->execute();
                    $count = $getCalenderItems->rowCount();

                } catch (PDOException $e) {
                    $e->getMessage();
                }

                $i = 0;

                while ($row = $getCalenderItems->fetch()) {

                    echo '
                                                        {
                                                        title: "' . $row['Onderdeelnaam'] . '",
                                                        start: new Date(' . $row['Start'] . '),
                                                        end: new Date(' . $row['Eind'] . '),
                                                        url: "./beoordelen/' . $row['CursusID'] . '"
                                                        }';

                    if ($i >= $count) {
                        echo "";
                    } else {
                        echo ",";
                    }

                    $i++;
                }

                ?>
            ]
        });

        calendar.render();
    });
</script>
<div id='calendar'></div>


</div>

标签: javascriptphpfullcalendar

解决方案


我在我的日历中添加了 3k+ 个事件,它运行良好。你可以在这里查看我的代码。

您能否检查浏览器控制台以查看是否有错误?

我使用的版本是 3.9.0。


推荐阅读