We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Edit event causes every other event to have it's value

I am trying to edit a new event I have created in my scheduler, but whenever I edit an existing Event, after I click on "save" on the editor dialog. The event has changed, but so has every other event. They will get the same Subject, Start- and End time as well as Body. This is event without having an "Action Completed" event tied to the Scheduler


1.png

if I change the event on thursday the 13th from 9:40AM to say, 11AM. this will happen2.png

does anyone know what causes this to happen?



4 Replies

VD Vinitha Devi Murugan Syncfusion Team October 17, 2022 05:12 AM

Hi Glenn,


Greetings from Syncfusion Support.


We have validated your reported issue at our end with below sample but appointment editing working fine at our end. Please refer working sample from below.


https://blazor.syncfusion.com/demos/scheduler/local-data?theme=fluent


We suspect that the issue might be due to any of your customization within the scheduler events may reset all the appointments. Can you please provide us the following details so that we could able replicate the issue and provide you a solution at earlier.


  • Please share complete Schedule rendering code.

  • Share your Scheduler version.

  • Did you used any Scheduler Events in your sample end. If yes, please share the events and it’s customization details.

  • If you using remote datasource for scheduler, please share the response screenshot in network tab after performed edit action.

  • If possible, please share issue replication sample.


Regards,

Vinitha



GM Glenn Mortensen October 24, 2022 05:19 AM

Hi, the following scheduler code is as follows:


@page "/testSchedule"
@page "/"
@using GoPlan.Shared.Services.Models
@inject HttpClient Http


<h3 class="mainTitle" >TestSchedule</h3>
<SfSchedule @ref="SfRef" Height="100%" EnableAutoRowHeight="false" TValue="EventModel"
            FirstDayOfWeek=1 @bind-SelectedDate="@CurrentDate" ShowWeekNumber=true
            StartHour="06:00" EndHour="22:00"
 AllowMultiCellSelection="false" AllowDragAndDrop HideEmptyAgendaDays AllowMultiRowSelection="false" >
  <ScheduleTemplates>
       <CellTemplate>
             <div class="cellSelection"/>
       </CellTemplate>
  </ScheduleTemplates>
    <ScheduleEvents TValue="EventModel" OnCellClick="onCellClick"
                 >
                </ScheduleEvents>
    <ScheduleEventSettings


        DataSource="@DataSource" TValue="EventModel" AllowAdding="true" AllowDeleting="true" AllowEditing="true">
        <ScheduleViews >
            <ScheduleView Option="View.Week" />
            <ScheduleView Option="View.Month" />
            <ScheduleView Option="View.MonthAgenda" />
        </ScheduleViews>
       </ScheduleEventSettings>
</SfSchedule>


<style>
     .e-selected-cell
    .cellSelection {
   background-color: deepskyblue;
    height: 100%;
    }


    .schedule-cell-dimension.e-schedule .e-vertical-view .e-time-cells-wrap .table .td,
    .schedule-cell-dimension.e-schedule .e-vertical-view .e-work-cells {
        height: 50px;
    }
    .howHigh{
        min-height: 500px;
    }
</style>


@code {
    DateTime CurrentDate = DateTime.UtcNow;
    #region click event handler
    SfSchedule<EventModel>? SfRef;
    //ActionCompleted="OnSaveChanges"
    //DataBound="onEventUPdate"
    //EventRendered="OnEventRendered"




    //is called whenever a CRUD action is called
    public async void OnSaveChanges(ActionEventArgs<EventModel> args)
    {
        if(args.AddedRecords != null)
        {
            var EventToAdd = args.AddedRecords[0];
            if(EventToAdd != null)
            {
                await Http.PostAsJsonAsync<EventModel>("Event", EventToAdd);
            }
        }
        if(args.ChangedRecords != null)
        {
            var EventToUpdate = args.ChangedRecords[0];
            if(EventToUpdate != null)
            {
                //await Http.PutAsJsonAsync<EventModel>("Event/" + EventToUpdate.EventId, EventToUpdate);
            }
        }
        if(args.DeletedRecords != null)
        {
            var eventToRemove = args.DeletedRecords[0];
            if (eventToRemove != null)
            {
                //await Http.DeleteAsync("Event/"+eventToRemove.EventId);
            }
        }
    }
    // when a date is clicked
    public async void onCellClick(CellClickEventArgs args)
    {
        args.Cancel = true; //to prevent default action
        await SfRef.OpenEditorAsync(args, CurrentAction.Add); //to open editor window
    }


    //when an event is updated
    public async void onEventUPdate(Syncfusion.Blazor.Schedule.DataBoundEventArgs<EventModel> args)
    {
        var test = args;
    }
    #endregion
    public void OnEventRendered(EventRenderedArgs<EventModel> args)
    {
       // args.CssClasses = new List<string>(CustomClass);
        var test = args;
    }
    // call on initial render
    public ICollection<EventModel> DataSource = new List<EventModel>();
    protected override async Task OnInitializedAsync()
    {
        DataSource = await Http.GetFromJsonAsync<ICollection<EventModel>>("Event"); // List
    }
}

I use the overall Syncfusion.Blazor package with a Scheduler import

My eventModel is as such


  public class EventModel
    {
        public int Id { get; set; }
        public string? EventId { get; set; }
        public string? Subject { get; set; }
        public DateTime? StartTime { get; set; }
        public DateTime? EndTime { get; set; }
        public bool IsBlock { get; set; }
    }


I'm afraid I can't provide a replication for the issue, because I am myself not sure how it is caused


hope this can help

regards

Glen



GM Glenn Mortensen October 25, 2022 05:55 AM

I think this code can be used to replicate the issue


@page "/"


<h3>BetaScheduler</h3>


<SfSchedule @ref="ScheduleRef" TValue="EventModel">
    <ScheduleEventSettings DataSource="@DataSource"></ScheduleEventSettings>
</SfSchedule>


@code {
    SfSchedule<EventModel> ScheduleRef;
    public class EventModel
    {
        public int Id { get; set; }
        public string? EventId { 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; }
        public bool IsBlock { get; set; }
    }


    public ICollection<EventModel> DataSource = new List<EventModel>();
    protected override async Task OnInitializedAsync()
    {
        DataSource.Add(new EventModel
            {
                EventId = "uhaoiuwhdoiauhwdiuahwd",
                Subject = "huh",
                StartTime = DateTime.Now.AddHours(2),
                EndTime = DateTime.Now.AddHours(5),
                //IsAllDay = calendarEvent.isAllDay,
                // Description = calendarEvent.body.content,
                IsBlock = false
            }
        );
        DataSource.Add(new EventModel
            {
                EventId = "uhaoiuwhdoiauhwdiuahwd",
                Subject = "hah",
                StartTime = DateTime.Now.AddHours(2).AddDays(1),
                EndTime = DateTime.Now.AddHours(5).AddDays(1),
                //IsAllDay = calendarEvent.isAllDay,
                // Description = calendarEvent.body.content,
                IsBlock = false
            }
      );
    }
}





VD Vinitha Devi Murugan Syncfusion Team October 26, 2022 05:53 AM

Hi Glenn,


Thanks for sharing file.


We have checked your reported problem by preparing sample with your shared code. We suggest you add Id field for appointments like below to resolve you reported problem. Also we have prepared sample with your shared code and solution for your reference.


https://www.syncfusion.com/downloads/support/directtrac/general/ze/ScheduleSample1380040972


protected override async Task OnInitializedAsync()

{

    DataSource.Add(new EventModel

    {

        Id = 1,

        EventId = "uhaoiuwhdoiauhwdiuahwd",

        Subject = "huh",

        StartTime = DateTime.Now.AddHours(2),

        EndTime = DateTime.Now.AddHours(5),

        //IsAllDay = calendarEvent.isAllDay,

        //  Description = calendarEvent.body.content,

        IsBlock = false

    }

    );

    DataSource.Add(new EventModel

    {

        Id= 2,

        EventId = "uhaoiuwhdoiauhwdiuahwd",

        Subject = "hah",

        StartTime = DateTime.Now.AddHours(2).AddDays(1),

        EndTime = DateTime.Now.AddHours(5).AddDays(1),

        //IsAllDay = calendarEvent.isAllDay,

        //  Description = calendarEvent.body.content,

        IsBlock = false

    }

  );


Kindly try with the above solutions and get back to us if you need any further assistance.


Regards,

Vinitha


Loader.
Live Chat Icon For mobile
Up arrow icon