fullcalendar.js,无法浏览句点

时间:2018-10-26 08:41:22

标签: jquery fullcalendar

我第一次使用fullcalendar.js,我成功实现了它,设法检索并显示了事件,现在正在设计日历。

但是,我的日历开始变得很奇怪,例如,现在,我无法在页面加载后的数周内浏览,唯一的方法是更改​​日历视图,单击月视图或日视图按钮,那么我将能够导航并返回至周视图以浏览周。无论使用哪种默认视图(如果是月视图,在没有先更改所选视图的情况下,我都无法进入下一个或前几个月),则标题中的日期会更改,但内容不会更改。

因为它以前已经起作用,所以我尝试使用更简单的代码重新启动(我尝试仅使用许可证密钥来初始化日历,并且在进行设计时,我删除了所有css),在浏览器控制台,我在Firefox和Chrome上都尝试过,我也擦除了浏览器缓存,但是并没有任何改善。

我非常确定与ajax调用无关(以前可以正常使用,现在即使没有它也无法使用),所以我不提供控制器代码。

我正在使用fullcalendar.3.9.0。

这是我的js(不在$(document).ready()中,但我尝试过并且它没有改变任何内容):

    $('#calendar').fullCalendar({
        schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
        themeSystem: 'bootstrap4',
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'agendaDay,agendaWeek,month'
        },
        bootstrapFontAwesome: {
            close: 'fa-times',
            prev: 'fa-chevron-left',
            next: 'fa-chevron-right',
            prevYear: 'fa-angle-double-left',
            nextYear: 'fa-angle-double-right'
        },
        defaultView: 'agendaWeek',
        firstDay: 1,
        allDaySlot: false,
        editable: false,
        droppable: false,
        columnFormat: 'ddd DD/MM',
        timeFormat: 'HH:mm',
        nowIndicator: true,
        events: function (start, end, timezone, callback) {
            Post('/Incident/GetInterventionList',
                {
                    start: start.format('YYYY-MM-DD'),
                    end: end.format('YYYY-MM-DD')
                },
                function (response) {
                    var events = [];

                    for (var i = 0; i < response.length; i++) {
                        let e = response[i];
                        events.push({
                            id: e.ActivityId,
                            title: e.SANumber + " | " + e.Subject,
                            start: moment(e.MorningStart ? e.MorningStart : e.EveningStart).toISOString(),
                            end: moment(e.EveningEnd ? e.EveningEnd : e.MorningEnd).toISOString(),
                            color: (e.StateCode == 0 ? '#ffc107' : (e.StateCode == 1 ? '#28a745' : (e.StateCode == 3 ? '#dc3545' : '#007bff')))
                        });
                    }

                    callback(events);
                });
        }
    });

这是我的css(我正在使用bootstrap.sass):

table {
    /*overflow: hidden;*/ /* blocks event display in fullCalendar */
    border: none !important;
    border-radius: 0.25rem !important;
}

table td, th {
    border: none !important;
}

table thead {
    border-radius: 0.25rem 0.25rem 0 0 !important;
}

table thead th:first-child, table thead th:first-child {
    overflow: hidden;
    border-radius: 0.25rem 0 0 0 !important;
}

table thead th:last-child, table thead th:last-child {
    overflow: hidden;
    border-radius: 0 0.25rem 0 0 !important;
}

table tfoot {
    border-radius: 0 0 0.25rem 0.25rem !important;
}

table tfoot td {
    min-height: 9px;
}

table tfoot tr:last-child td:first-child {
    overflow: hidden;
    border-radius: 0 0 0 0.25rem !important;
}

table tfoot tr:last-child td:last-child {
    overflow: hidden;
    border-radius: 0 0 0.25rem 0 !important;
}

.fc-scroller {
    max-height: 60vh;
    height: 60vh !important;
}

#calendar .btn {
    margin:3px;
}

.fc-event {
    box-shadow: 0px 1px 4px black;
}

table table {
    box-shadow: none !important;
    border: none !important;
}

table tfoot td {
    height: 9px;
}

.fc-row {
    border: none !important;
}

感谢您的阅读,我们将不胜感激。

1 个答案:

答案 0 :(得分:0)

希望这会有所帮助,问题不在此处提供的代码中,实际上我的代码中有一些声音完全干扰了fullCalendar(如建议的@ADyson,请参见注释),我正在修改fullCalendar主表(动态添加页面加载之后的$scope.validateName=function(obj){ var name = obj.name; var regex = new RegExp("^[a-zA-Z0-9\/\@\&\%\*\$\>\<\\[\\]\,\(\)\_\'\;\ \:\\-\\.]+$"); if(name != undefined && name != null && name.length < 3){ obj.errMsg = "Please enter minimum 3 characters in Name"; } else obj.errMsg = ''; }; 标签),这就是问题的根源。