我的自定义编辑器模板
<script id="customEditorTemplate" type="text/x-kendo-template">
<div class="k-edit-label"><label for="title">Заголовок</label></div>
<div data-container-for="title" class="k-edit-field">
<input type="text" class="k-input k-textbox" name="title" required="required" data-bind="value:title">
</div>
<div class="k-edit-label">
<label for="start">Дата события</label>
</div>
<div data-container-for="start" class="k-edit-field">
<input type="text"
data-role="datetimepicker"
data-interval="15"
data-type="date"
data-bind="value:start,invisible:isAllDay"
name="start"/>
<input type="text" data-type="date" data-role="datetimepicker" data-bind="value:start,visible:isAllDay" name="start" />
<span data-bind="text: startTimezone"></span>
<span data-for="start" class="k-invalid-msg" style="display: none;"></span>
</div>
<div class="k-edit-label"><label for="content">Текст</label></div>
<div data-container-for="content" class="k-edit-field">
<textarea name="content" class="k-textbox" data-bind="value:content"></textarea>
</div>
<div class="k-edit-label"><label for="active">Статус</label></div>
<div data-container-for="active" class="k-edit-field">
<select id="active" data-bind="value:active" data-role="dropdownlist"
data-value-field="value" data-text-field="text">
<option value="1">Показать</option>
<option value="0">Скрыть</option>
</select>
</div>
创建 Kendo Scheduler JS:
qwe.schCalendarOfEvents = $(".schCalendarOfEvents").kendoScheduler({
date: new Date(),
startTime: new Date(),
height: 400,
timezone: "Etc/UTC",
views: [
"day",
"week",
{ type: "month", selected: true },
"agenda",
"timeline"
],
selectable: true,
//dataBinding: scheduler_dataBinding,
//dataBound: scheduler_dataBound,
save: scheduler_save,
dataSource: {
schema: {
model: {
id: "ID",
fields: {
ID: { from: "ID", type: "number" },
title: { from: "HEADER", defaultValue: "No title", validation: { required: true } },
start: { type: "date", from: "NDATE" },
//end: { type: "date", from: "End" },
//startTimezone: { from: "StartTimezone" },
//endTimezone: { from: "EndTimezone" },
content: { from: "CONTENT" },
active: { from: "ACTIVE" }
}
//recurrenceId: { from: "RecurrenceID" },
// recurrenceRule: { from: "RecurrenceRule" },
// recurrenceException: { from: "RecurrenceException" },
// ownerId: { from: "OwnerID", defaultValue: 1 },
// isAllDay: { type: "boolean", from: "IsAllDay" }
}
}
},
editable: {
template: $("#customEditorTemplate").html(),
}
}).data('kendoScheduler');
调度程序保存事件:
function scheduler_save(e) {
var header = $('input[name="title"]').val();
var ndate = $('input[name="start"]').val();
ndate = ndate + ":00";
var content = $('textarea[name="content"]').val();
var active = $('select#active').find("option:selected").val();
$.post(rootUrl + 'Editor/InsertTblEvents', { header: header, ndate: ndate, content: content, active: active }, function (data) {
if (data.ErrorMessage)
alert(data.ErrorMessage);
else {
}
});
}
我的模型:
public class TblEvents
{
public short ACTIVE { get; set; }
public string CONTENT { get; set; }
public string HEADER { get; set; }
public DateTime? NDATE { get; set; }
}
要创建此模型 EditorTemplate。我有调度程序保存事件将数据存储在数据库中。但是当我给 DataSource 它没有显示在调度程序中