|
import { RecurrenceEditor } from '@syncfusion/ej2-schedule';
export class EditorTemplate extends SampleBase {
constructor() {
super(...arguments);
this.data = extend([], dataSource.doctorsEventData, null, true);
}
onPopupOpen(args) {
if (args.type === "Editor") {
let recurElement = args.element.querySelector('#RecurrenceRule');
if (!recurElement.classList.contains('e-recurrenceeditor')) {
let recurrObject = new RecurrenceEditor({});
recurrObject.appendTo(recurElement);
this.scheduleObj.setRecurrenceEditor(recurrObject);
}
document.getElementById('RecurrenceRule').style.display = (this.scheduleObj.currentAction == "EditOccurrence") ? 'none' : 'block';
}
}
editorTemplate(props) {
return ((props !== undefined) ? (
<table className="custom-event-editor" style={{ width: "100%" }}>
<tbody>
<tr><td className="e-textlabel">Recurrence</td><td colSpan={4}>
<div id='RecurrenceRule' data-name="RecurrenceRule"></div>
</td></tr>
</tbody>
</table>) : (<div></div>));
}
render() {
return (<div className='schedule-control-section'>
<div className='col-lg-12 control-section'>
<div className='control-wrapper'>
<ScheduleComponent ref={schedule => this.scheduleObj = schedule} editorTemplate={this.editorTemplate.bind(this)} popupOpen={this.onPopupOpen.bind(this)} >
</ScheduleComponent>
</div>
</div>
</div>);
}
}
render(<EditorTemplate />, document.getElementById('sample')); |
|
onPopupOpen = (args) => {
this.startTime = args.data.startTime;
this.endTime = args.data.endTime;
if (args.type === "Editor") {
args.cancel = true;
if (args.target.classList.contains("e-appointment")) {
this.dialogInstance.header = "Update Class";
this.temp = false;
this.id = args.data.Id;
} else {
this.dialogInstance.header = "Create Class";
this.temp = true;
this.dialogInstance.show();
this.dialogInstance.content = this.content({start: args.data.startTime, end: args.data.endTime});
}
}
}; |