如何在fullcalender JS中删除allDay?

时间:2017-09-12 13:56:55

标签: javascript fullcalendar

我正在尝试构建一个在fullcalendar中创建事件的应用程序。我不允许用户创建一个" allDay"客户端的事件,但他们仍然可以在视图中看到它。有没有方法可以完全从视图中删除allDays?

function initCalendar {
    if (!jQuery().fullCalendar) {
        return;
    }

    var date = new Date(),
        started,
        ended

    var header = {};

    var calendar = $('#calendar').fullCalendar({
        header: header,
        selectable: true,
        selectHelper: true,

        select: function (start, end, allDay) {
            $('#fc_create').click();
            var dateStart = start; 
            var dateEnd = end;

            $(".antosubmit").on("click", function() {
                var title = $("#reservation-title").val();

                if (title) {
                    var event = {
                        editable: true,
                        title: title,
                        start: dateStart,
                        end: dateEnd,
                        allDay: false
                    }

                    calendar.fullCalendar('renderEvent', event, true);
                    calendar.fullCalendar('unselect');
                    #('.antoclose').click();

                    return false;
                }
                else {
                    ////alert here
                }
            })
        }
    })
}

1 个答案:

答案 0 :(得分:14)

来自文档:

allDaySlot: false

https://fullcalendar.io/docs/agenda/allDaySlot/