Setting first day of week to Monday in kendo scheduler

混江龙づ霸主 提交于 2019-12-23 10:01:13

问题


I want to set first day of week to monday instead of sunday in kendo scheduler It is working fine for me if i am using DatePicker, but not for Scheduler.


回答1:


Can be made possible with one line of code. Add

kendo.culture().calendar.firstDay = 1;

before kendo scheduler declaration

$("#yourID").kendoScheduler({... })

Found the solution here and worked for me. Kendo culture setting




回答2:


As of Kendo UI v2015.2.805, you need to set the calendar.firstDay property of the current Kendo culture. However, this property is not public, so you'll need to use the following array accessor in order to avoid compile errors in Visual Studio.

kendo.culture().calendar["firstDay"] = 1;

Then, as Vishn Vikraman pointed out, instantiate your scheduler:

$("#yourID").kendoScheduler({... })



回答3:


KendoUI Scheduler widget the first day of the week is read from the current culture.

<script type="text/javascript">
     //set current to the "en-GB" culture script
     kendo.culture("en-GB");
</script>



回答4:


I see two options depending on what you want:

  1. If you find a culture that is how you want it then use it. This means that if you are using one that is not en-US (default one), you will be changing also name of days, decimals separators, currency...
  2. If you just need to change the first day of the week for a specific culture. Then you should overwrite the value kendo.cultures["en-US"].calendars.standard.firstDay (replace en-US by you culture code or use en-US for the default).

$("#date1").kendoDatePicker({
    culture: "es-ES"
});


// Force first day of week to 1 = Monday for en-US
kendo.cultures["en-US"].calendars.standard.firstDay = 1; 
$("#date2").kendoDatePicker({
});
<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.2.716/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.2.716/styles/kendo.default.min.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://cdn.kendostatic.com/2014.2.716/js/kendo.all.min.js"></script>
<script src="http://cdn.kendostatic.com/2013.2.716/js/cultures/kendo.culture.es-ES.min.js"></script>

<div>es-ES: <input id="date1"/></div>
<div>en-US (modified): <input id="date2"/></div>



回答5:


In your kendo.all.min.js script file, look for:

calendars:{standard:{days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]

and change Sunday to the end of the list, like this:

calendars:{standard:{days:{names:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday", "Sunday"]

Do the same for the short names, right after the "calendars" part in the script



来源:https://stackoverflow.com/questions/26419587/setting-first-day-of-week-to-monday-in-kendo-scheduler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!