重新加载 Kendo UI 调度程序
Reloading a Kendo UI scheduler
你好,
我有两个不同的调度程序一个接一个地显示。
在一个 js 文件中,我有这个功能:
function doRafraichirInterface() {
if (b_FENETRE_OUVERTE) {
return;
}
if (flag == false){
flag = true;
console.log(flag);
}
else{
flag = false;
console.log(flag);
}
// Rafraichissement du planning
$("#scheduler").data("kendoScheduler").dataSource.read();
$("#scheduler").data("kendoScheduler").refresh();
}
此函数每 15 秒调用一次。
并且在 .aspx 文件中,我使用 Kendo UI 计划:
var myView = kendo.ui.MultiDayView.extend({
options: {
selectedDateFormat: "{0:D} - {1:D}"
},
name: "Un jour",
calculateDateRange: function() {
//create a range of dates to be shown within the view
var ladate = new Date();
var Today = ladate.getDay();
var year = ladate.getFullYear();
var month = ladate.getMonth();
var day = ladate.getDate();
var selectedDate = this.options.date,
idx, length,
dates = [];
if (flag == false)
dates.push(new Date(year, month, day));
else{
if (Today == 1)
{
var start = kendo.date.dayOfWeek(selectedDate, Today - 2, -1);
}
else
{
var start = kendo.date.dayOfWeek(selectedDate, Today - 1, -1);
}
for (idx = 0, length = 8; idx < length; idx++) {
if (start.getDay() != 0) {
dates.push(start);
}
start = kendo.date.nextDay(start);
}
}
this._render(dates);
}
});
如何重新加载调度程序以更改视图?
提前感谢您的回答,抱歉我的英语和函数和评论的法语名称不好。
EDIT :我看到了一个 "scheduler.view" 方法,可以让我在两个视图之间切换。所以我将我分成两个函数,如下所示:
var oneDayView = kendo.ui.MultiDayView.extend({
options: {
selectedDateFormat: "{0:D} - {1:D}"
},
name: "Un jour",
calculateDateRange: function() {
//create a range of dates to be shown within the view
var ladate = new Date();
var year = ladate.getFullYear();
var month = ladate.getMonth();
var day = ladate.getDate();
var selectedDate = this.options.date,
idx, length,
dates = [];
dates.push(new Date(year, month, day));
this._render(dates);
}
});
var oneWeekView = kendo.ui.MultiDayView.extend({
options: {
selectedDateFormat: "{0:D} - {1:D}"
},
name: "Une semaine",
calculateDateRange: function() {
//create a range of dates to be shown within the view
var ladate = new Date();
var Today = ladate.getDay();
var selectedDate = this.options.date,
idx, length,
dates = [];
if (Today == 1)
{
var start = kendo.date.dayOfWeek(selectedDate, Today - 2, -1);
}
else
{
var start = kendo.date.dayOfWeek(selectedDate, Today - 1, -1);
}
for (idx = 0, length = 8; idx < length; idx++) {
if (start.getDay() != 0) {
dates.push(start);
}
start = kendo.date.nextDay(start);
}
this._render(dates);
}
});
并将 "doRafraichirInterface" 更改为:
function doRafraichirInterface() {
if (b_FENETRE_OUVERTE) {
return;
}
if (flag == true){
console.log(flag);
flag=false;
$("#scheduler").data("kendoScheduler").view("oneDayView");
}
else{
console.log(flag);
flag=true;
$("#scheduler").data("kendoScheduler").view("oneWeekView");
}
// Rafraichissement du planning
$("#scheduler").data("kendoScheduler").dataSource.read();
$("#scheduler").data("kendoScheduler").refresh();
}
但是我的观点没有切换,有什么想法吗?
EDIT2:我试图用我上面描述的方法在 "day" 和 "week" 之间切换它正在工作。新问题是:如何在两个 CustomView 之间切换?
我终于找到了为什么它不起作用。如果以后有人遇到同样的问题,我post回答。
我的调度程序声明中缺少一个参数。
<%=Html.Kendo()
.Scheduler<IntranetMVC.Models.Planification>()
.Name("scheduler")
.Date(DateTime.Now)
.Height(737)
.AllDaySlot(false)
.StartTime(new DateTime(2000, 1, 1, 0, 0, 0))
.EndTime(new DateTime(2099, 12, 31, 23, 55, 55))
.ShowWorkHours(true)
.WorkDayStart(new DateTime(2000,1, 1, 7, 0, 0))
.WorkDayEnd(new DateTime(2099,12, 31, 18, 0, 0))
// Configuration des vues disponibles
.Views(views=>
{
views.CustomView("oneDayView");//Don't forget to put every
views.CustomView("oneWeekView");// views that you need to switch to.
})
希望有一天它能对某人有所帮助!
你好,
我有两个不同的调度程序一个接一个地显示。
在一个 js 文件中,我有这个功能:
function doRafraichirInterface() {
if (b_FENETRE_OUVERTE) {
return;
}
if (flag == false){
flag = true;
console.log(flag);
}
else{
flag = false;
console.log(flag);
}
// Rafraichissement du planning
$("#scheduler").data("kendoScheduler").dataSource.read();
$("#scheduler").data("kendoScheduler").refresh();
}
此函数每 15 秒调用一次。
并且在 .aspx 文件中,我使用 Kendo UI 计划:
var myView = kendo.ui.MultiDayView.extend({
options: {
selectedDateFormat: "{0:D} - {1:D}"
},
name: "Un jour",
calculateDateRange: function() {
//create a range of dates to be shown within the view
var ladate = new Date();
var Today = ladate.getDay();
var year = ladate.getFullYear();
var month = ladate.getMonth();
var day = ladate.getDate();
var selectedDate = this.options.date,
idx, length,
dates = [];
if (flag == false)
dates.push(new Date(year, month, day));
else{
if (Today == 1)
{
var start = kendo.date.dayOfWeek(selectedDate, Today - 2, -1);
}
else
{
var start = kendo.date.dayOfWeek(selectedDate, Today - 1, -1);
}
for (idx = 0, length = 8; idx < length; idx++) {
if (start.getDay() != 0) {
dates.push(start);
}
start = kendo.date.nextDay(start);
}
}
this._render(dates);
}
});
如何重新加载调度程序以更改视图?
提前感谢您的回答,抱歉我的英语和函数和评论的法语名称不好。
EDIT :我看到了一个 "scheduler.view" 方法,可以让我在两个视图之间切换。所以我将我分成两个函数,如下所示:
var oneDayView = kendo.ui.MultiDayView.extend({
options: {
selectedDateFormat: "{0:D} - {1:D}"
},
name: "Un jour",
calculateDateRange: function() {
//create a range of dates to be shown within the view
var ladate = new Date();
var year = ladate.getFullYear();
var month = ladate.getMonth();
var day = ladate.getDate();
var selectedDate = this.options.date,
idx, length,
dates = [];
dates.push(new Date(year, month, day));
this._render(dates);
}
});
var oneWeekView = kendo.ui.MultiDayView.extend({
options: {
selectedDateFormat: "{0:D} - {1:D}"
},
name: "Une semaine",
calculateDateRange: function() {
//create a range of dates to be shown within the view
var ladate = new Date();
var Today = ladate.getDay();
var selectedDate = this.options.date,
idx, length,
dates = [];
if (Today == 1)
{
var start = kendo.date.dayOfWeek(selectedDate, Today - 2, -1);
}
else
{
var start = kendo.date.dayOfWeek(selectedDate, Today - 1, -1);
}
for (idx = 0, length = 8; idx < length; idx++) {
if (start.getDay() != 0) {
dates.push(start);
}
start = kendo.date.nextDay(start);
}
this._render(dates);
}
});
并将 "doRafraichirInterface" 更改为:
function doRafraichirInterface() {
if (b_FENETRE_OUVERTE) {
return;
}
if (flag == true){
console.log(flag);
flag=false;
$("#scheduler").data("kendoScheduler").view("oneDayView");
}
else{
console.log(flag);
flag=true;
$("#scheduler").data("kendoScheduler").view("oneWeekView");
}
// Rafraichissement du planning
$("#scheduler").data("kendoScheduler").dataSource.read();
$("#scheduler").data("kendoScheduler").refresh();
}
但是我的观点没有切换,有什么想法吗?
EDIT2:我试图用我上面描述的方法在 "day" 和 "week" 之间切换它正在工作。新问题是:如何在两个 CustomView 之间切换?
我终于找到了为什么它不起作用。如果以后有人遇到同样的问题,我post回答。
我的调度程序声明中缺少一个参数。
<%=Html.Kendo()
.Scheduler<IntranetMVC.Models.Planification>()
.Name("scheduler")
.Date(DateTime.Now)
.Height(737)
.AllDaySlot(false)
.StartTime(new DateTime(2000, 1, 1, 0, 0, 0))
.EndTime(new DateTime(2099, 12, 31, 23, 55, 55))
.ShowWorkHours(true)
.WorkDayStart(new DateTime(2000,1, 1, 7, 0, 0))
.WorkDayEnd(new DateTime(2099,12, 31, 18, 0, 0))
// Configuration des vues disponibles
.Views(views=>
{
views.CustomView("oneDayView");//Don't forget to put every
views.CustomView("oneWeekView");// views that you need to switch to.
})
希望有一天它能对某人有所帮助!