actionBegin={this.onActionbegin.bind(this)}
onActionbegin(args) {
if (args.requestType == "dateNavigate") {
if (this.scheduleObj.selectedDate <= this.date) {
args.cancel = (args.event.target.classList.contains('e-icon-prev'));
}
}
} |
<ScheduleComponent ref={schedule => this.scheduleObj = schedule} width='100%' height='650px' ref={t => this.scheduleObj = t} eventSettings={{ dataSource: this.data }} renderCell={this.onRenderCell.bind(this)} popupOpen={this.onPopupOpen.bind(this)} actionBegin={this.onActionBegin.bind(this)} actionComplete={this.onActionComplete.bind(this)}>
<Inject services={[Day, Week, WorkWeek, Month, Agenda, Resize, DragAndDrop]} />
</ScheduleComponent>
onPopupOpen(args) {
if (args.data.name === "cellClick") {
if ((args.data.startTime) < new Date(new Date().setHours(0, 0, 0, 0))) {
args.cancel = true;
}
} else {
if ((args.data.StartTime) < new Date(new Date().setHours(0, 0, 0, 0))) {
args.cancel = true;
}
}
}
onRenderCell(args) {
if (args.date < new Date(new Date().setHours(0, 0, 0, 0))) {
args.element.classList.add('e-disableCell');
}
}
onActionBegin(args) {
if (args.requestType === "eventChange") {
if ((args.data.StartTime) < new Date(new Date().setHours(0, 0, 0, 0))) {
args.cancel = true;
}
}
if (args.requestType === "eventCreate") {
for (var i = 0; i < args.data.length; i++) {
if ((args.data[i].StartTime) < new Date(new Date().setHours(0, 0, 0, 0))) {
args.cancel = true;
}
}
}
}
onActionComplete(args) {
if (args.requestType === "toolBarItemRendered") {
this.scheduleObj.element.querySelectorAll('.e-schedule-toolbar .e-date-range')[0].click();
this.scheduleObj.element.querySelectorAll('.e-calendar')[0].ej2_instances[0].min = new Date();
this.scheduleObj.element.querySelectorAll('.e-schedule-toolbar .e-date-range')[0].click();
}
}
|