@Html.EJS().Schedule("schedule").SelectedDate(new DateTime(2018, 2, 15)).Width("100%").Height("550px").EventSettings(e => e.DataSource(ViewBag.appointments)).PopupOpen("onPopupOpen").EventClick("onEventClick").CellClick("onCellClick").Render()
function onCellClick(args) {
args.cancel = true;
this.editorTemplate = "#CellEditorTemplate";
this.dataBind();
this.openEditor(this.activeCellsData, 'Add');
}
function onEventClick(args) {
args.cancel = true;
this.editorTemplate = "#EventEditorTemplate";
this.dataBind();
this.openEditor(this.activeEventData.event, 'Save');
}
function onPopupOpen(args) {
if (args.type === 'Editor') {
var statusElement = args.element.querySelector('#EventType');
if (!ej.base.isNullOrUndefined(statusElement)) {
if (!statusElement.classList.contains('e-dropdownlist')) {
var dropDownListObject = new ej.dropdowns.DropDownList({
placeholder: 'Select a status', value: statusElement.value,
dataSource: ['New', 'Requested', 'Confirmed']
});
dropDownListObject.appendTo(statusElement);
statusElement.setAttribute('name', 'EventType');
}
}
var startElement = args.element.querySelector('#StartTime');
if (!startElement.classList.contains('e-datetimepicker')) {
new ej.calendars.DateTimePicker({ value: new Date(startElement.value) || new Date() }, startElement);
}
var endElement = args.element.querySelector('#EndTime');
if (!endElement.classList.contains('e-datetimepicker')) {
new ej.calendars.DateTimePicker({ value: new Date(endElement.value) || new Date() }, endElement);
}
}
} |