So I used this example to get CRUD editing with your Scheduler tool
Blazor Scheduler External Form Editing Example - Syncfusion Demos
, but I get this error:
Argument 2: cannot convert from 'method group' to 'EventCallback'
Here is my markup code:
<SfSchedule TValue="VwCalendarItemsSlim" Height="650px" SelectedDate="@(CurrentDate)">
<ScheduleEvents TValue="VwCalendarItemsSlim" OnEventDoubleClick="OnEventDoubleClick" OnEventClick="OnEventClick" OnCellClick="OnCellClick" OnCellDoubleClick="OnCellDoubleClick"></ScheduleEvents>
<ScheduleEventSettings DataSource="@DataSource">
<ScheduleField Id="MatterEventId">
<FieldSubject Name="Subject"></FieldSubject>
<FieldStartTime Name="StartDate"></FieldStartTime>
<FieldEndTime Name="EndDate"></FieldEndTime>
<FieldIsAllDay Name="IsAllDay"></FieldIsAllDay>
<FieldStartTimezone Name="TimeZone"></FieldStartTimezone>
<FieldRecurrenceRule Name="RecurrenceInfo"></FieldRecurrenceRule>
<FieldLocation Name="Location"></FieldLocation>
<FieldDescription Name="EventDescription"></FieldDescription>
</ScheduleField>
</ScheduleEventSettings>
<ScheduleTimeScale Interval="60" SlotCount="6"></ScheduleTimeScale>
<ScheduleViews>
<ScheduleView Option="View.Day"></ScheduleView>
<ScheduleView Option="View.Week"></ScheduleView>
<ScheduleView Option="View.WorkWeek"></ScheduleView>
<ScheduleView Option="View.Month"></ScheduleView>
<ScheduleView Option="View.Agenda"></ScheduleView>
</ScheduleViews>
</SfSchedule>
and the code to go with it:
private async Task OnSave()
{
if (isCellClick)
{
//await this.Schedule.AddEvent(SelectedData);
CalendarService.InsertUpdateOrDelete(SelectedData);
isCellClick = false;
}
else
{
//await this.Schedule.SaveEvent(SelectedData);
CalendarService.InsertUpdateOrDelete(SelectedData);
}
}
private void OnCancel()
{
SelectedData = new MatterEvent()
{
EventDateAssigned = new DateTime(2020, 1, 10, 9, 0, 0),
EventCompletionDate = new DateTime(2020, 1, 10, 10, 0, 0),
Subject = "Add title"
};
}
private void OnEventClick(EventClickArgs<MatterEvent> args)
{
args.Cancel = true;
SelectedData = args.Event;
}
private void OnEventDoubleClick(EventClickArgs<MatterEvent> args)
{
args.Cancel = true;
}
private async Task OnCellClick(CellClickEventArgs args)
{
args.Cancel = isCellClick = true;
SelectedData = new MatterEvent();
//SelectedData.Id = await this.Schedule.GetMaxEventId<int>();
//SelectedData.EventDateAssigned = args.EventDateAssigned;
//SelectedData.EventCompletionDate = args.EndTime;
//SelectedData.Subject = args.Subject;
//SelectedData.Location = args.Location;
}
private void OnCellDoubleClick(CellClickEventArgs args)
{
args.Cancel = true;
}
I also note that the OnCellClick event doesn't seem to contain the selected appointment. MatterEvent is the database model that I use for Appointments.
TIA,
public AppointmentData SelectedData = new AppointmentData() { StartDate = new DateTime(2020, 1, 10, 9, 0, 0), EndDate = new DateTime(2020, 1, 10, 10, 0, 0) };
private async Task OnCellClick(CellClickEventArgs args)
{
args.Cancel = isCellClick = true;
SelectedData = new AppointmentData();
SelectedData.MatterEventId = await this.Schedule.GetMaxEventId<int>();
SelectedData.StartDate = args.StartTime;
SelectedData.EndDate = args.EndTime;
SelectedData.Subject = "Add title";
SelectedData.Location = null;
} |