@using Syncfusion.EJ2.Blazor
@using Syncfusion.EJ2.Blazor.Schedule
@using Microsoft.JSInterop
@using ScheduleLocalization.Data
<EjsSchedule @ref="ScheduleObj" TValue="AppointmentData" Height="650px" @bind-SelectedDate="@selectedDate">
<ScheduleEvents TValue="AppointmentData" ActionCompleted="OnActionCompleted"></ScheduleEvents>
</EjsSchedule>
@code {
EjsSchedule<AppointmentData> ScheduleObj;
[Inject]
IJSRuntime JsRuntime { get; set; }
DateTime selectedDate = new DateTime(2018, 2, 14);
protected override void OnAfterRender(bool firstRender)
{
this.JsRuntime.Ejs().LoadLocaleData("wwwroot/locale.json").SetCulture("de").LoadCldrData(new string[] { "wwwroot/ca-gregorian.json", "wwwroot/timeZoneNames.json", "wwwroot/numbers.json" });
}
List<AppointmentData> DataSource = new List<AppointmentData>
{
new AppointmentData { Id = 1, Subject = "Paris", StartTime = new DateTime(2018, 2, 13, 10, 0, 0) , EndTime = new DateTime(2018, 2, 13, 12, 0, 0) },
new AppointmentData { Id = 2, Subject = "Germany", StartTime = new DateTime(2018, 2, 15, 10, 0, 0) , EndTime = new DateTime(2018, 2, 15, 12, 0, 0) },
new AppointmentData { Id = 3, Subject = "Holland", StartTime = new DateTime(2018, 2, 17, 10, 0, 0) , EndTime = new DateTime(2018, 2, 17, 12, 0, 0) ,RecurrenceRule = "FREQ=DAILY;INTERVAL=1;COUNT=5" }
};
public void OnActionCompleted(ActionEventArgs<AppointmentData> args)
{
if (args.RequestType == "eventCreated")
{
// will trigger when appointment created
}
if (args.RequestType == "eventRemoved")
{
// will trigger when appointment deleted
}
if (args.RequestType == "eventChanged")
{
// will trigger when appointment edited
}
}
} |