Monday weekend kendo schedule and culture setup

I appreciate kendo-ui, and I would like to set up views views: [{type: "week", ...}, { type: "workweek", ...}, { type: "month", ...}] kendo-ui scheduler to always start on Monday.

I found Q: Setting the first day of the week on Monday , but it has no accepted answers, and the proposed solutions did not work for me.

Trying to install workWeekStart

So, after several attempts, I ended up:

 $("#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 } ] }); 

As you can see, this works for type:"workWeek" , every week starts on Monday, and since I set workWeekEnd:0 , it ends on Sunday. Using the same configuration settings on type:"week" or type:"month" does not work - the week always starts on Sunday.

Kendo-ui schedulre workweek start mondays

Attempt to establish a culture

I tried three configuration options (see // try # 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 may be

  • I'm doing it wrong
  • inside kendo.all.js, I found only one preliminary configuration of the kendo.cultures["en-US"] culture kendo.cultures["en-US"] , so I assume that I need to create a configuration myself or create / edit a localization file

Questions

  • How can I set Monday on the first day of the week for view types type: "week" ... type:"month"
  • How to set up culture for a schedule widget
  • Do I need to create a localization file or configure the desired de-DE culture manually or are there any pre-configured cultures somewhere in the kendo kit that I can use?

Arrays for the code above

 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
source share
1 answer

To set the start day of the week as Monday, enter the bottom line of code before declaring the scheduler.

  kendo.culture().calendar.firstDay = 1; // and further down initialize the scheduler $("#yourID").kendoScheduler({ // ... 

This works for both monthly and weekly viewing. Hope this helps.

+6
source

Source: https://habr.com/ru/post/976858/


All Articles