@(Html.EJS().Schedule("schedule")
.ActionComplete("onActionComplete")
.Render()
)
<script type="text/javascript">
function
onActionComplete(args) {
if
(args.requestType === "toolBarItemRendered" || args.requestType ===
'eventCreated' || args.requestType === 'eventChanged' || args.requestType ===
'eventRemoved') {
var span;
var scheduleObj = document.querySelector('.e-schedule').ej2_instances[0];
var datas = scheduleObj.eventSettings.dataSource;
(scheduleObj.element.querySelectorAll('.e-schedule-toolbar
.e-date-range')[0]).click();
var calendar =
(scheduleObj.element.querySelectorAll('.e-calendar')[0]).ej2_instances[0];
calendar.renderDayCell
= function (args) {
(datas).forEach(function (data) {
if (args.date.getTime() - (new Date(data.StartTime.getFullYear(),
data.StartTime.getMonth(), data.StartTime.getDate())).getTime() === 0) {
span = document.createElement('span');
span.setAttribute('class', 'e-icons highlight');
args.element.setAttribute('title', 'Event!');
args.element.firstElementChild.setAttribute('title', 'Event !');
args.element.appendChild(span);
}
});
};
calendar.refresh();
(scheduleObj.element.querySelectorAll('.e-schedule-toolbar
.e-date-range')[0]).click();
}
}
|