when the scheduler is in "mobile" mode, e.g. the view selector goes from buttons to a single dropdown, whenever you click the dropdown, it calls my navigate and paramterMap function and calls the read api. Then when i select the new view it calls again. All calls have the correct date ranges.
how do i get stop the first call from occurring? e.g. it is making 2 calls every time. The second call is the correct call. The first call is essentially re-calling the initialization script or pulling in the same data it already has loaded.
code snippet
$("#scheduler").kendoScheduler({
toolbar: ["pdf"],
pdf: {
fileName: "My_School_Year_Calendar.pdf",
proxyURL: "//demos.telerik.com/kendo-ui/service/export"
},
startTime: today,
date: today,
timezone: "",
allDayEventTemplate: adTemplate,
eventTemplate: eTemplate,
views: [
{ type: "agenda", selected: true },
"day",
"week",
"month"
],
editable: false,
dataBound: scheduler_dataBound,
dataSource: {
transport: {
read: {
url: "@Url.Action("Calendar", "Homeroom")",
dataType: "json",
contentType: "application/json; charset=utf-8",
type: "POST"
},
parameterMap: function (options, operation) {
if (operation === "read") {
var scheduler = $("#scheduler").data("kendoScheduler");
var result = {
start: scheduler.view().startDate().toMsyString(),
end: scheduler.view().endDate().toMsyString()
};
return kendo.stringify(result);
}
return kendo.stringify(options);
}
},
serverFiltering: true,
schema: {
model: {
id: "taskID",
fields: {
classId: { from: "ClassId", type: "number" },
taskID: { from: "TaskID", type: "number" },
title: { from: "Title", defaultValue: "No title", validation: { required: true } },
start: { type: "date", from: "Start" },
end: { type: "date", from: "End" },
ownerId: { from: "StudentId", defaultValue: 1 },
isAllDay: { type: "boolean", from: "IsAllDay" }
}
}
}
},
filter: {
logic: "or",
filters: [
{ field: "ownerId", operator: "eq", value: 513 },
{ field: "ownerId", operator: "eq", value: 531 }
]
},
resources: [
{
field: "ownerId",
title: "Student",
dataSource: [
@Html.Raw(@Model.Sources.StudentResourceJs)
]
}
],
change: function (e) {
var start = e.start;
var end = e.end;
console.log(kendo.format("Selection between {0:g} and {1:g}", start, end));
},
navigate: function (e) {
console.log("navigate", e.date);
}
});