ScheduleView initial Loading not displaying all data

1 Answer 22 Views
ScheduleView
Benedikt
Top achievements
Rank 3
Iron
Iron
Iron
Benedikt asked on 13 Dec 2021, 10:35 AM

Hi guys,

I have a small testproject where I want do display a few projects with appointments.
I wanted to use the Group functionality together with resourcetypes.

Now everything works but not in the inital loading. Somehow the Group part on the left side is not displayed.
After pressing the button "aktualisieren" it displays as intended.

I tried to call the aktualisieren after loading of the window, but same, it stays empty at first.

I attached the project.
Maybe someone has an idea what causes this.

 

Greetings.

 

1 Answer, 1 is accepted

Sort by
1
Accepted
Stenly
Telerik team
answered on 16 Dec 2021, 10:31 AM

Hello Benedikt,

I was able to reproduce the mentioned behavior, when running the sample project, on my end as well. This is expected because the ScheduleView control intentionally does not listen for changes in the Resources collection property of the ResourceType class.

With that said, in order for the groups to be present, when initially loading the application, you could use the approaches from the Update the Resources article, and more specifically, the second one, which is Adding/removing resources at run time. Basically, you would need to remove the ResourceType instance from the collection that holds all of the resource types, and then add it again.

The following code snippet shows the BackgroundWorkerWork method, from the provided project, modified to include the above-mentioned approach:

private void BackgroundWorkerWork(object sender, DoWorkEventArgs e) { Resource res1 = new Resource(); res1.ResourceName = "Projekt 1"; Resource res2 = new Resource(); res2.ResourceName = "Projekt 2"; Resource res3 = new Resource(); res3.ResourceName = "Projektierer 1"; Application.Current.Dispatcher.Invoke(() => ResourceType.Resources.Add(res1)); Application.Current.Dispatcher.Invoke(() => ResourceType.Resources.Add(res2)); //Remove and Add the ResourceType after adding a new Resource Application.Current.Dispatcher.Invoke(() => ResourceTypeCollection.Remove(ResourceType)); Application.Current.Dispatcher.Invoke(() => ResourceTypeCollection.Add(ResourceType)); Application.Current.Dispatcher.Invoke(() => ResourceType2.Resources.Add(res3)); //Remove and Add the ResourceType after adding a new Resource Application.Current.Dispatcher.Invoke(() => ResourceTypeCollection.Remove(ResourceType2)); Application.Current.Dispatcher.Invoke(() => ResourceTypeCollection.Add(ResourceType2)); Appointment app1 = new Appointment() { Subject = "Front-End Meeting", Start = DateTime.Today.AddHours(9), End = DateTime.Today.AddHours(10) };
app1.Resources.Add(res1); app1.Resources.Add(res3); Application.Current.Dispatcher.Invoke(() => Appointments.Add(app1)); Appointment app2 = new Appointment() { Subject = "Planning Meeting", Start = DateTime.Today.AddHours(11), End = DateTime.Today.AddHours(12), }; app2.Resources.Add(res2); app2.Resources.Add(res3); Application.Current.Dispatcher.Invoke(() => Appointments.Add(app2)); }

I have attached the provided sample project, that has this approach implemented, so, could you give it a try?

Regards,
Stenly
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Benedikt
Top achievements
Rank 3
Iron
Iron
Iron
commented on 16 Dec 2021, 01:53 PM

Hi Stenly,

thanks for the provided solution.

With that everything works. :)

 

Tags
ScheduleView
Asked by
Benedikt
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Stenly
Telerik team
Share this question
or