问题描述
我正在评估kendo-ui,我想配置视图 views: [{type: "week", ...}, { type: "workweek", ...}, { type: "month", ...}]
"rel =" nofollow noreferrer> kendo-ui调度程序总是从星期一开始.
I am evaluating kendo-ui and i would like to configure the views views: [{type: "week", ...}, { type: "workweek", ...}, { type: "month", ...}]
of kendo-ui scheduler to always start with monday.
我发现了问:将一周的第一天设置为星期一,但是没有可接受的答案,并且提供的解决方案不适用于我.
I found Q: Setting first day of week to Monday but is has no accepted answers and offered solutions did not work for me.
因此,在尝试了几件事之后,我最终得到了:
So after trying several things out i ended up with:
$("#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"
上使用相同的配置设置无效-星期总是从星期日开始.
As you can see this works for type:"workWeek"
every week starts with a monday and since i set workWeekEnd:0
it ends with sunday. Using the same configuration settings on type:"week"
or type:"month"
has no effect - the week always starts with a sunday.
我尝试了三个配置选项(请参见下面的//尝试编号)
I tried three configuration options (see // attempt # below)
// 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
但是它们都不起作用.原因可能是
But none of them had any effect. The reason could be
- 我做错了
- 在kendo.all.js内,我仅发现一种文化预配置
kendo.cultures["en-US"]
,所以我假设我需要自己创建配置或创建/编辑一些本地化文件
- i am doing it wrong
- inside kendo.all.js i found only one culture preconfiguration
kendo.cultures["en-US"]
so i am assuming i need to create an configuration myself or create / edit some localisation file
- 如何将视图类型
type: "week" ... type:"month"
的星期一设置为一周的第一天 - 如何设置时间表小部件的区域性
- 我是否必须手动创建一个本地化文件或设置所需的区域性"de-DE",还是可以在kendo-ui捆绑包中的某个位置使用其他预先配置的区域性?
- How can i set monday to be the first day of the week for the views types
type: "week" ... type:"month"
- How can i set the culture for the schedule widget
- Do i have to create a localisation file or set up the desired culture "de-DE" by hand or are there more preconfigured cultures somewhere in the kendo-ui bundle that i can use?
上面代码的数组
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] }];
推荐答案
要将每周的开始日期设置为星期一",请将以下代码行放在调度程序声明之前.
To set start day of week as "Monday" put the below line of code before the scheduler declaration.
kendo.culture().calendar.firstDay = 1;
// and further down initialize the scheduler
$("#yourID").kendoScheduler({
// ...
这适用于月视图和周视图.希望这会有所帮助.
This works both for month and week view.Hope this helps.
这篇关于剑道时间表设置星期开始到星期一并设置文化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!