我正在评估kendo-ui,我想将views的kendo-ui scheduler views: [{type: "week", ...}, { type: "workweek", ...}, { type: "month", ...}]
配置为始终以星期一开始。
我找到Q: Setting first day of week to Monday但是没有接受的答案,并且提供的解决方案对我不起作用。
所以在尝试了几件事后我最终得到了:
$("#scheduler2").kendoScheduler({
date: new Date("2014/12/1"),
allDayEventTemplate: $("#event-template").html(),
timezone: "Etc/UTC",
views: [{ type:"day", showWorkHours:true, workWeekStart:0}
,{type:"week", workWeekStart:1, workWeekEnd:5
, showWorkHours:true, selected:true}
,{type:"workWeek", workWeekStart:1, workWeekEnd:0
, showWorkHours: true, selected: true }
,{type:"month", workWeekStart: 2 }
, "agenda"]
,dataSource: events1,
resources: [ { field: "attendees", dataSource: people1, multiple: true } ]
});
正如你所看到的那样,type:"workWeek"
每周都适用于星期一,因为我设置workWeekEnd:0
它以星期日结束。在type:"week"
或type:"month"
上使用相同的配置设置无效 - 本周始终以星期日开始。
我尝试了三种配置选项(参见//下面的尝试#)
// attempt 1
kendo.culture("de-DE");
$("#scheduler2").kendoScheduler({
date: new Date("2014/12/1"),
culture: "de-DE", // attempt 2
allDayEventTemplate: $("#event-template").html(),
views: [{ type:"week", culture: "de-DE", // attempt 3
但他们都没有任何影响。原因可能是
kendo.cultures["en-US"]
所以我假设我需要自己创建配置或创建/编辑一些本地化文件type: "week" ... type:"month"
的一周的第一天var people1 = [{ text: "Alex", value: 1, color: "blue" }
, { text: "Bob", value: 2, color: "red" }
, { text: "Charlie", value: 3, color: "yellow" }
, { text: "Doris", value: 4, color: "green" }];
var events1 = [
{ id: 1, title: "Int A 2.12", start: new Date("2014/12/2 08:00 AM"), end: new Date("2014/12/2 09:00 AM"), isAllDay: false, attendees: [1, 2] },
{ id: 2, title: "Int B 2.12", start: new Date("2014/12/2 08:30 AM"), end: new Date("2014/12/2 10:30 AM"), isAllDay: false, attendees: [2, 3] },
{ id: 3, title: "Int C 2. - 5.", start: new Date("2014/12/2 08:30 AM"), end: new Date("2014/12/5 10:30 AM"), isAllDay: true, attendees: [1] },
{ id: 4, title: "Int D 3. - 4.", start: new Date("2014/12/3 08:30 AM"), end: new Date("2014/12/4 10:30 AM"), isAllDay: true, attendees: [3] },
{ id: 5, title: "Int E 4.12", start: new Date("2014/12/4 10:00 AM"), end: new Date("2014/12/4 2:00 PM"), isAllDay: false, attendees: [1, 4] }];
答案 0 :(得分:6)
要将星期的开始日期设置为“星期一”,请在调度程序声明之前输入以下代码行。
kendo.culture().calendar.firstDay = 1;
// and further down initialize the scheduler
$("#yourID").kendoScheduler({
// ...
这适用于月视图和周视图。 希望这会有所帮助。