Hello,
Im triyng to build a schedular that has a different template for an existing event, but also return the standard create event template when it's a new event.
var d = new Date();
d.setHours((d.getHours() - 4), 0, 0, 0);
$("#scheduler").kendoScheduler({
date: new Date(),
startTime: d,
views: [
"day",
{ type: "workWeek", selected: true },
"week",
"month",
"agenda",
{ type: "timeline", eventHeight: 50 }
],
editable: {
template: function (
if (e.taskId > 0) { // check if new or existing task by e.taskId
return $("#contactForm").html();
}
return // this is where i want to return the standard template.....
}
},
edit: function (e) {
var buttonsContainer = e.container.find(".k-edit-buttons");
var cancelButton = buttonsContainer.find(".k-scheduler-cancel");
var saveButton = buttonsContainer.find(".k-scheduler-update");
saveButton.html($("#contactForm .k-buttons .add-button")[0]);
cancelButton.html($("#contactForm .k-buttons .cancel-button")[0]);
},
timezone: "Etc/UTC",
dataSource: {
transport: {
read: {
url: "/api/calendar/GetAgendaItems",
contentType: "application/json; charset=utf-8",
method: "GET",
dataType: "json",
isASPNETPost: false,
data: { EmployeeId: '71' }
},
update: {
url: "/api/calendar/UpdateAgendaItem",
method: "PUT",
dataType: "json"
},
create: {
url: "/api/calendar/CreateAgendaItem",
method: "",
dataType: "json"
},
destroy: {
url: "/api/calendar/AgendaItem",
method: "DELETE",
dataType: "json"
},
parameterMap: function (options, operation) {
console.log(kendo.stringify(options), operation);
if (operation !== "read" && options.models) {
return options.models[0];
//return kendo.stringify(options);
}
return options
}
},
schema: {
model: {
id: "taskId",
fields: {
taskId: { from: "taskID", type: "number" },
title: { from: "title", defaultValue: "No title", validation: { required: true } },
start: { type: "date", from: "startTime" },
end: { type: "date", from: "endTime" },
startTimezone: { from: "startTimezone" },
endTimezone: { from: "endTimezone" },
description: { from: "description" },
recurrenceId: { from: "recurrenceID" },
recurrenceRule: { from: "recurrenceRule" },
recurrenceException: { from: "recurrenceException" },
ownerId: { from: "ownerID" },
isAllDay: { type: "boolean", from: "isAllDay" }
}
}
}
},
resources: [
{
field: "ownerID",
title: "HomeVisitor",
dataSource: {
transport: {
read: {
url: "/api/calendar/GetEmployees",
method: "GET"
}
}
}
}
]
});