OnActionComplete Only Fires EventCreated

My scheduler is only firing the EventCreated event, even when the edit screen is opened and I hit save. Not sure what I'm missing here. 


I've attached my component, code behind, and model.


Attachment: SchedulerIssue_73e49400.zip

12 Replies 1 reply marked as answer

VM Vengatesh Maniraj Syncfusion Team December 14, 2021 08:11 AM UTC

Hi Evan,


Greetings from Syncfusion Support.

We suggest mapping the ID field for the EventModel to perform better CRUD actions. 


namespace CabinApp.Services.Events.Models

{

    public class EventModel : BaseModel

    {

        public int Id { get; set; }

        public string Subject { get; set; }

        public string Location { get; set; }

        public DateTime StartTime { get; set; }

        public DateTime EndTime { get; set; }

        public string Description { get; set; }

        public bool IsAllDay { get; set; }

        public string RecurrenceRule { get; set; }

        public string RecurrenceException { get; set; }

        public int? RecurrenceID { get; set; }

    }

}


Regards,

Venga



EV Evan replied to Vengatesh Maniraj December 14, 2021 01:36 PM UTC

Hi,


My apologies but I forgot to add the BaseModel file. In that class I do actually have the ID field. However it is of type Guid and not int as you have suggested above. Does the scheduler only allow for integer IDs or will it use Guid as well? All data is mapping ok from the database to the front end so that would be the only difference I can see. 


One thing I should add is when I load the data it shows up just fine and I can edit the event and see all the data I previously saved. 


Evan



VM Vengatesh Maniraj Syncfusion Team December 15, 2021 06:08 AM UTC

Hi Evan,


Thanks for the update.


Yes. The Scheduler allows the Guid IDs as well. And, we suggest to use the RecurrenceID also as Guid type since the RecurrenceID is depending on the ID field. We made this changes alone at our end and it works fine. Could you please check the below code snippet?


namespace CabinApp.Services.Events.Models

{

    public class EventModel : BaseModel

    {

        public Guid Id { get; set; }

        public string Subject { get; set; }

        public string Location { get; set; }

        public DateTime StartTime { get; set; }

        public DateTime EndTime { get; set; }

        public string Description { get; set; }

        public bool IsAllDay { get; set; }

        public string RecurrenceRule { get; set; }

        public string RecurrenceException { get; set; }

        public Guid? RecurrenceID { get; set; }

    }

}

 


Regards,

Vengatesh



EV Evan December 16, 2021 04:26 AM UTC

Thanks for the new stuff to try. Unfortunately, it appears this did not fix it. The recurrence ID has been changed to the Guid type but it still comes back as Create event rather than Change. Any other ideas on what might be causing this to always go to Create? I've also included a screenshot of the data right after I hit save on the edit screen. 


The ID seen here is the same one persisted in the database so it's correctly pulled that back. 




VM Vengatesh Maniraj Syncfusion Team December 17, 2021 05:02 AM UTC

Hi Evan,


Thanks for the update.

We would like to let you know that the ActionType is as EventChange when we change the event which is already created. Accordingly, we are not able to replicate your problem at our end. So could you please share the video demo of this problem or share the replication steps?


Regards,

Vengatesh 



EV Evan December 18, 2021 01:51 AM UTC

Hey Vengatesh,


I've added a video of what is going on. I did 2 tests. The first I add a record which saves, and then I try editing it. I found that the ID is an empty guid (all zeroes). I then add a second event and save. Then I reload and edit, which has the entity guid this time around. With both tests it's always coming back with a Create operation. Just to go back to my component code, is there anything you can see that is off with this?



Thanks for your continued support on this. I'm sure it's going to be something simple.


Evan


Attachment: ShedulerErrorReproduction_71c1af01.7z



BS Balasubramanian Sattanathan Syncfusion Team December 20, 2021 12:45 PM UTC

Hi Evan,

Thanks for the update.

We have analyzed and tried to reproduce your reported problem at our end by preparing the below-attached sample. But unfortunately, we couldn't reproduce it. Since the CRUD action has been worked properly even the appointment id as GUID. So, we would suggest you to refer and follow the sample.

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Blazor_sample824729706.zip

Video demo: https://www.syncfusion.com/downloads/support/directtrac/general/ze/video_demo93201976.zip


If you still face the problem at your end, kindly share the below details.

- Share the Syncfusion NuGet version of your project
- If not the latest version, Did you check with our latest version?


Regards,
Balasubramanian S



EV Evan December 21, 2021 01:41 AM UTC

Hey  Balasubramanian,


I believe I have found the issue! I've got two screenshots here for you using the sample you provided. 

The first you'll see is stopped on ActionComplete and the event is Create. This is actually right after I hit save on the edit screen. I want to direct your attention to the model though. I changed the Id column to be spelled ID and I can see now that the key appears to be case sensitive. I don't have this issue with any other component so I think this might actually be a bug. 


The second screenshot is back to Id and sure enough it comes through as EventChange. 


Let me know your thoughts on this. Would you consider this a bug?





EV Evan December 21, 2021 02:14 AM UTC

Just wanted to also add I have updated to 19.4.38 and the issue is still there. 



BS Balasubramanian Sattanathan Syncfusion Team December 21, 2021 11:44 AM UTC

Hi Evan,

Thanks for the reply.

We are happy that you have found the cause of the reported problem at your end and let you know that we can use the different custom field names for Scheduler fields by using ScheduleField tag and its related tags like the below UG. So, we would suggest you to refer and follow the below UG. And also we have modified the sample with Id as ID and sent back to you.

UG: https://blazor.syncfusion.com/documentation/scheduler/appointments#event-fields

Code snippet:

<SfSchedule @ref="ScheduleObj" TValue="AppointmentData" Height="550px" SelectedDate="@(new DateTime(2020, 1, 31))">

    <ScheduleViews>

        <ScheduleView Option="View.Month"></ScheduleView>

        <ScheduleView Option="View.Agenda"></ScheduleView>

    </ScheduleViews>

    <ScheduleEventSettings DataSource="@DataSource" AllowEditing="true" AllowAdding="true" AllowDeleting="true">

        <ScheduleField Id="ID">

        </ScheduleField>

    </ScheduleEventSettings>

    <ScheduleEvents TValue="AppointmentData" OnActionBegin="@OnActionBegin" ActionCompleted="OnActionComplete"></ScheduleEvents>

</SfSchedule>

 

. . .
. . .
. . .

    List<AppointmentData> DataSource = new List<AppointmentData>

    {

        new AppointmentData {

            ID = new Guid("183c9ae7-3cb1-4413-a71d-9698de8d82ea"), Subject = "Meeting", StartTime = new DateTime(2020, 1, 14, 9, 30, 0) , EndTime = new DateTime(2020, 1, 14, 11, 0, 0)

        },

        new AppointmentData {

            ID = new Guid("be77323a-765f-4c70-aaa8-45fb4c7c69aa"), Subject = "Testing", StartTime = new DateTime(2020, 1, 15, 9, 30, 0) , EndTime = new DateTime(2020, 1, 15, 11, 0, 0)

        }

    };

. . .

. . .

. . .

public class AppointmentData
{

        public Guid ID { get; set; }

        public string Subject { get; set; }

        public string Location { get; set; }

        public DateTime StartTime { get; set; }

        public DateTime EndTime { get; set; }

        public string Description { get; set; }

        public bool IsAllDay { get; set; }

        public string RecurrenceRule { get; set; }

        public string RecurrenceException { get; set; }

        public Guid? RecurrenceID { get; set; }

}


Kindly refer to the above solution and let us know if this is helpful.


Regards,
Balasubramanian S


Attachment: Blazor_sample_5204b902.zip

Marked as answer

EV Evan December 22, 2021 01:10 AM UTC

Thanks for all the support on this. That was the answer to all this. 



VM Vengatesh Maniraj Syncfusion Team December 22, 2021 03:41 AM UTC

Hi Evan,


You are most welcome.


Regards,

Vengatesh 


Loader.
Up arrow icon