我正在使用 Fullcalendar 来显示用户进出时间。
我按以下顺序在完整日历中显示了标签。
先入
、持续时间
、后出
。一切正常。
但在 Chrome 浏览器
中,某些日期的标签显示顺序不同。
启动全日历
$('#calendar').fullCalendar({
theme: true,
header: {
left: 'prev,today,next',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
contentHeight: 400,
editable: false,
weekends: true,
aspectRatio: 2,
events: arr//Array of labels First In, Duration, Last out
});
它应该是给定的顺序,但不是。这个问题有什么解决方案吗?
Plnkr 上的实时预览 URL:http://plnkr.co/edit/8rxDGUUBJVRq1dja0Xm1?p=preview
最佳答案
尝试升级到 fullcalendar 2.4.0 或更高版本并使用 eventOrder选项。
By default, FullCalendar decides that events with longer durations and earlier start times are sorted above other events. However, events often have the same exact start time and duration, which is especially true for all-day events. By default, when this happens, events are sorted alphabetically by title.
eventOrder
provides the ability to override this behavior.
fullcalendar 1.5.3 似乎没有等效的选项或文档。但是,凭直觉,我尝试将开始日期增加几毫秒。 Chrome 尊重开始日期的顺序。见:
http://plnkr.co/edit/cM5Af5hVEh6vqSu6A5df?p=preview
注意:我还更新了数据以使用 eventSources展示您如何不需要一遍又一遍地指定颜色。
关于javascript - 全日历标签顺序在 Chrome 浏览器中不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33140425/