render() {
return (<div className='schedule-control-section'>
<div className='col-lg-12 control-section'>
<div className='control-wrapper'>
<ScheduleComponent width='100' height='650px' selectedDate={new Date(2018, 1, 15)} ref={t => this.scheduleObj = t} eventSettings={{ dataSource: this.data }} popupOpen={this.onPopupOpen.bind(this)}>
<Inject services={[Day, Week, WorkWeek, Month, Agenda, Resize, DragAndDrop]}/>
</ScheduleComponent>
</div>
</div>
</div>);
} |
onPopupOpen(args) {
if(args.type === 'Editor') {
// Fetching editor dialog object
let dialogObj = document.querySelector('.e-schedule-dialog').ej2_instances[0];
// Fetching the fotter element of the editor window
let footer = dialogObj.element.querySelector('.e-footer-content');
// Creting the button element
let btnElement = createElement("BUTTON", {innerHTML: "Custom Button"});
// Creting the button object
let buttonObj = new Button();
// Appeding the button object to the button element
buttonObj.appendTo(btnElement);
// Appendig the creted button to the footer of the editor window.
footer.appendChild(btnElement);
// Binding the evnet to the custom button element
buttonObj.element.onclick = () => alert('Custom button click');
}
} |
.e-event-save, .e-event-delete {
display: none;
} |
onPopupOpen(args) {
if (args.type === 'Editor') {
let dialogObj = (args.element).ej2_instances[0];
let buttons;
if (args.target.classList.contains('e-appointment')) {
this.currentEvent = this.scheduleObj.getEventDetails(args.target);
buttons = [{
buttonModel: { content: 'SAVE', isPrimary: true }, click: this.editEvent.bind(this)
}, {
buttonModel: { content: 'DELETE', cssClass: 'e-event-delete' }, click: this.eventDelete.bind(this)
},
{
buttonModel: { content: 'CANCEL', cssClass: 'e-event-cancel' }, click: this.dialogClose.bind(this)
}];
} else {
buttons = [{
buttonModel: { content: 'SAVE', isPrimary: true }, click: this.eventAdd.bind(this)
}, {
buttonModel: { content: 'CANCEL', cssClass: 'e-event-cancel' }, click: this.dialogClose.bind(this)
}];
}
dialogObj.buttons = buttons;
dialogObj.dataBind();
}
} |