我正在开发一个使用Kendo UI调度程序的项目。调度程序是使用javascript创建的。由于性能,要求是加载特定日期范围(自定义视图)的数据,然后在客户端上进行过滤。问题是,当您使用serverFiltering = true
时,客户端过滤器不起作用。有没有办法将可见数据集加载到调度程序中,然后应用客户端过滤器?
调度程序加载如下:
var scheduler = $("#scheduler").kendoScheduler({
date: new Date(),
height: 600,
views: [
type: "month", eventHeight: 50},
{ type: "PlanboardView", selected: true, eventHeight: 60},
{ type: "timelineMonth", eventHeight: 50, majorTick: 1440, minorTickCount: 1 }
],
dataSource: {
batch: false,
//serverFiltering: true,
transport: {
prefix: "",
read: {
url: "<the url>",
type: "POST",
dataType: "json"
},
parameterMap: function (options, operation) {
if (operation === "read") {
var scheduler = $("#scheduler").data("kendoScheduler");
var result = {
start: scheduler.view().startDate().toISOString(),
end: scheduler.view().endDate().toISOString()
}
return result;
}
if(operation != "read")
{
return kendo.stringify(
options
);
}
return options;
}
}
}
}).data("kendoScheduler");
我的下一个/上一个导航按钮:
function scheduler_navigate(e) {
//e.preventDefault(); <-- when used, it's not reloading
console.log("navigate function", e.date);
this.dataSource.read();
this.refresh();
// when using this function and navigating to the next / previous range. The application Always takes the datarange from the visible dates before
}
要将此功能绑定到我的调度程序,我使用:scheduler.bind("navigate", scheduler_navigate);