|
import { ViewEncapsulation, Component, ViewChild, OnInit } from '../../node_modules/@angular/core';
import { ChangeEventArgs } from '@syncfusion/ej2-buttons';
import { EventSettingsModel, View, EventRenderedArgs, DayService, WeekService, WorkWeekService, MonthService, AgendaService, ScheduleComponent } from '@syncfusion/ej2-ng-schedule';
import { eventsData } from './datasource';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
providers: [DayService, WeekService, WorkWeekService, MonthService, AgendaService],
encapsulation: ViewEncapsulation.None
})
export class AppComponent implements OnInit {
public data: Object[] = eventsData;
public selectedDate: Date = new Date(2018, 1, 15);
public currentView: View = 'Week';
@ViewChild('scheduleObj')
public scheduleObj: ScheduleComponent;
public temp: string = '<div class="tooltip-wrap">' +
'<div class="image ${EventType}"></div>' +
'<div class="content-area"><div class="name">${Subject}</></div>' +
'${if(City !== null && City !== undefined)}<div class="city">${City}</div>${/if}' +
'<div class="time">From : ${StartTime.toLocaleString()} </div>' +
'<div class="time">To : ${EndTime.toLocaleString()} </div></div></div>';
public eventSettings: EventSettingsModel = { dataSource: this.data, enableTooltip: true, tooltipTemplate: this.temp };
ngOnInit(): void {
}
-----------------
-----------------
-----------------
}
|
|
<ejs-schedule #scheduleObj width='100%' height='550px' [selectedDate]="selectedDate" [showQuickInfo]="showQuickInfo" [eventSettings]="eventSettings" (cellClick)="onCellClick($event)" (eventClick)="onEventClick($event)">
</ejs-schedule>
|
|
onCellClick(args: CellClickEventArgs) {
console.log("Cell Details By Click");
console.log(args); // Here displaying the cell details coming in the cellClick event args
console.log("Cell Details By Method");
let cellElement: Element = args.element as Element;
console.log(this.scheduleObj.getCellDetails(cellElement)); // Here displaying the cell details using the method by passing the clicked cell element
}
onEventClick(args: EventClickArgs) {
console.log("Event Details By Click");
console.log(args); // Here displaying the event details coming in the eventClick event args
console.log("Event Details By Method");
let eventElement: Element = args.element as Element;
console.log(this.scheduleObj.getEventDetails(eventElement)); // Here displaying the event details using the method by passing the clicked event element
}
|