Fullcalendar时间轴视图的最后一列总是更宽

时间:2016-11-07 09:50:06

标签: javascript fullcalendar fullcalendar-scheduler

我为fullcalendar调度程序的时间轴视图创建了自定义视图(timelineCustomMonth,timelineCustomWeek,timelineCustomDay)。

然而,无论分辨率如何,最后一列总是比前一列宽。

我可以说这不是另一个CSS文件的问题,因为我排除了除fullcalendar之外的所有CSS文件,问题是相同的。

Fullcalendar v3.0.1 Fullcalendar-Scheduler v1.4.0

这是我的javascript fullcalendar初始化:

$("#calendar").each(function () {

    var calendar = $(this);

    calendar.fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right:       'timelineCustomMonth,timelineCustomWeek,timelineCustomDay,listMonth'
        },
        firstDay: 1,
        eventLimit: true,
        schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
        resources: {
            url: '/machines',
            dataType: 'json'
        },
        resourceAreaWidth: "15%",
        events: {
            url: '/events',
            dataType: 'json'
        },
        views: {
            timelineCustomMonth: {
                type: 'timeline',
                duration: {month: 1},
                slotWidth: 5,
                slotDuration: {days: 1},
                slotLabelFormat: [
                    'D',
                    'dd'
                ]
            },
            timelineCustomWeek: {
                type: 'timeline',
                duration: {days: 7},
                slotWidth: 5,
                slotDuration: {hours: 4},
                slotLabelInterval: {hours: 4},
                slotLabelFormat: [
                    'D',
                    'H'
                ]
             },
            timelineCustomDay: {
                type: 'timeline',
                duration: {days: 1},
                slotWidth: 5,
                slotDuration: {minutes: 30},
                slotLabelInterval: {hours: 1},
                slotLabelFormat: [
                    'H'
                ]
            }
        }
    });
});

这是发生问题的两个不同视图的屏幕截图:

timelineCustomMonth

timelineCustomDay

提前致谢。

1 个答案:

答案 0 :(得分:0)

就我而言,将 slotWidth 设置为相对值(5%),可以解决最后一列伸出的问题。

$('#schedule').fullCalendar({
        schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
        now: new Date(),

        slotWidth: "5%",

        resourceAreaWidth: '200px',
        contentHeight: 'auto',
        eventOverlap: false,
        selectOverlap: false
        ...
});