7

我为全日历调度程序的时间线视图创建了自定义视图(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'
                ]
            }
        }
    });
});

这是出现问题的不同视图的两个屏幕截图:

时间线自定义月

时间线CustomDay

提前致谢。

4

1 回答 1

0

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

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

        slotWidth: "5%",

        resourceAreaWidth: '200px',
        contentHeight: 'auto',
        eventOverlap: false,
        selectOverlap: false
        ...
});
于 2019-04-29T12:00:17.267 回答