SfSchedule not displaying OnInitialized data

I'm using SfSchedule to display a List of ScheduleForm data, which is generated in OnInitialized method using previously loaded data from ScheduleService​. However, when the application is opened, the SfSchedule is loaded as empty. Even after the data is loaded, the SfSchedule doesn't display the data, even though the List<ScheduleForm> is correctly filled. Why doesn't SfSchedule work with data from OnInitialized method?

SfSchedule code:

@page "/schedule"

@using MyProject.Shared.Models

@inject IScheduleService ScheduleService

<SfSchedule TValue="ScheduleForm" SelectedDate="@(new DateTime(2021, 4, 12))" CurrentView="View.Week" FirstDayOfWeek="1">    

<ScheduleViews>       

<ScheduleView Option="View.Day" StartHour="07:00" EndHour="22:00"></ScheduleView>        

<ScheduleView Option="View.Week" StartHour="07:00" EndHour="22:00"></ScheduleView>   

</ScheduleViews>    

<ScheduleEventSettings DataSource="@schedules"></ScheduleEventSettings>

</SfSchedule>

@code:

@code {    

int number = 1;    
string course = "A";    
List<MyProject.Shared.Models.Schedule> schedulesData = new List<MyProject.Shared.Models.Schedule>();    
List<ScheduleForm> schedules = new List<ScheduleForm>();    

protected override async Task OnInitializedAsync()    
{        
await ScheduleService.LoadSchedules();        
schedulesData = ScheduleService.Schedules;        
int i = 0;        
foreach (var schedule in schedulesData)        
{            
foreach (var entry in schedule.Entries)            
{                
if (entry.Course == course && entry.Subject.Number == number)                
{                    
DateTime StartDate = new DateTime(schedule.Date.Year, schedule.Date.Month,                    schedule.Date.Day, entry.Start.Hour, entry.Start.Minute, 0);     
DateTime EndDate = new DateTime(schedule.Date.Year, schedule.Date.Month,                  schedule.Date.Day, entry.End.Hour, entry.End.Minute, 0);                    
schedules.Add(new ScheduleForm()                    
{                        
Id = i++,                       
StartTime = StartDate,                        
EndTime = EndDate,                        
Subject = entry.Subject.Value,                        
Description = entry.Description,                        
Location = entry.Location});                
}
}        
}
}    
public class ScheduleForm    
{        
public int Id { get; set; }        
public DateTime StartTime { get; set; }        
public DateTime EndTime { get; set; }        
public string Subject { get; set; }        
public string Description { get; set; }        
public string Location { get; set; }    
}
}

2 Replies

NR Nevitha Ravi Syncfusion Team July 27, 2021 12:51 PM UTC

Hi Kristina, 

Greetings from Syncfusion Support. 

We could replicate the problem ‘appointment not displaying when defined in OnInitialized’ at our end and confirm this as defect. We have logged the bug report which can be tracked through the following link. 

The fix will be included in our Volume 2 SP release expected to be rolled out by mid of August, 2021. So we appreciate your patience until then. 

Regards, 
Nevitha 



NR Nevitha Ravi Syncfusion Team August 12, 2021 04:54 PM UTC

Hi Kristina, 

We are glad to announce that our Essential Studio 2021 Volume 2 SP release v19.2.0.55 is rolled out and is available for download under the following link. This release has fixed the bug ‘appointments which defined in onIntialized is not displaying”’. As a result, we recommend you upgrade to the latest version of our Syncfusion package to avail of this fix. 
 
 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
 
Regards, 
Nevitha 


Loader.
Up arrow icon