<ejs-schedule id="schedule" height="100%" actionbegin="onActionBegin" databound="onDataBound">
<e-schedule-eventsettings>
<e-data-manager url="/Home/LoadData" crudurl="Home/UpdateData" adaptor="UrlAdaptor" crossdomain="true">
</e-data-manager>
</e-schedule-eventsettings>
</ejs-schedule>
var flag = false;
function onActionBegin(args) {
if (args.requestType === 'eventCreate' || args.requestType === 'eventChange') {
var subject = (args.requestType === 'eventCreate') ? args.data[0].Subject : (args.data).Subject;
if (subject == 'New') {
args.cancel = true;
flag = true;
}
}
}
function onDataBound() {
var scheduleObj = document.getElementById('schedule').ej2_instances[0];
scheduleObj.eventWindow.dialogObject.beforeClose = function (args) {
args.cancel = flag;
flag = false;
alert("Don't Close the Appointment Window");
}
} |
var startElement = args.element.querySelector('#StartTime');
if (!startElement.classList.contains('e-datetimepicker')) {
new ej.calendars.DateTimePicker({ strictMode:true , value: new Date(startElement.value) || new Date() }, startElement);
}
var endElement = args.element.querySelector('#EndTime');
if (!endElement.classList.contains('e-datetimepicker')) {
new ej.calendars.DateTimePicker({ strictMode: true, value: new Date(endElement.value) || new Date() }, endElement);
} |
This approach isn't working anymore as of 09/06/2022.
Is there an updated method?
Hi Gene,
We have checked on your query and let you know that the Date Time Picker component is working fine with strictMode using the latest version. Please find the below sample for your reference.
Sample: https://stackblitz.com/edit/48exnr-6tvce5?file=index.js,index.html
Documentation: https://ej2.syncfusion.com/documentation/api/datetimepicker/#strictmode
Let us know if you need further assistance.
Regards,
Ruksar Moosa Sait