How to Trigger for Edit and Delete Appointment on Scheduler Control ?

Hi All ,

I am creating CRUD operation with scheduler control, I m trying to trigger event for Insert/Update/Delete like this. But it is working only for Create Appointment.
could please give me exact syntax for Update and Delete ?


 <SfSchedule TValue="AppointmentData" Width="900px" Height="700px" AllowDragAndDrop="true"  EnableAutoRowHeight="true"
                            @bind-CurrentView="CurrentView">
                    <ScheduleViews>
                        <ScheduleView Option="View.Day" StartHour="07:00" EndHour="19:00"></ScheduleView>
                        <ScheduleView Option="View.Week" StartHour="07:00" EndHour="19:00"></ScheduleView>
                        <ScheduleView Option="View.Month" ShowWeekend="true"></ScheduleView>
                        <ScheduleView Option="View.TimelineDay" StartHour="07:00" EndHour="19:00"></ScheduleView>
                    </ScheduleViews>
           <ScheduleEvents TValue="AppointmentData" ActionCompleted="OnActionCompleted"></ScheduleEvents>

    public void OnActionCompleted(Syncfusion.Blazor.Schedule.ActionEventArgs<AppointmentData> args)
    {
        string msg = string.Empty;
        switch (args.ActionType)
        {
            case ActionType.EventChange:
               // msg = ScheduleService.UpdateAppointmentData(args.AddedRecords[0]);
                break;
            case ActionType.EventCreate:
                msg = ScheduleService.CreateAppointmentData(args.AddedRecords[0]);
                break;
            case ActionType.EventRemove:
               // msg = ScheduleService.DeleteAppointmentData(args.AddedRecords[0]);
                break;
            case ActionType.ViewNavigate:
                break;
            case ActionType.DateNaviagte:
                break;
            case ActionType.ResourceExpand:
                break;
            case ActionType.ResourceCollapse:
                break;
            default:
                break;
        }

1 Reply

RV Ravikumar Venkatesan Syncfusion Team February 15, 2021 11:38 AM UTC

Hi Chandradev, 
  
Greetings from Syncfusion support. 
  
We have validated your reported query at our end and we suggest you pass the args.ChangedRecords[0] to your UpdateAppointmentData method and pass the args.DeletedRecords[0] to your DeleteAppointmentData method instead of passing the args.AddedRecords[0]
  
    public void OnActionCompleted(ActionEventArgs<AppointmentData> args) 
    { 
        switch (args.ActionType) 
        { 
            case ActionType.EventChange: 
                msg = ScheduleService.UpdateAppointmentData(args.ChangedRecords[0]); 
                break; 
            case ActionType.EventCreate: 
                msg = ScheduleService.CreateAppointmentData(args.AddedRecords[0]); 
                break; 
            case ActionType.EventRemove: 
                msg = ScheduleService.DeleteAppointmentData(args.DeletedRecords[0]); 
                break; 
            default: 
                break; 
        } 
    } 
  
Kindly refer to the below UG link for more details and get back to us if you need any further assistance. 
  
  
Regards, 
Ravikumar Venkatesan 


Loader.
Up arrow icon