I've been searching here and any other websites that show up in a search online for anything that seemed answer my question but haven't seen anything yet.
I'm looking for a way to prevent appointments from being automatically selected when they have been updated. My appointments are removed and re-added to their collection, which appears to be the only way to successfully update the UI per this forum. I think it was this post I found, for those who are curious - https://www.telerik.com/forums/update-ui-after-collection-of-appointment-change
My problem is this: background logic is updating appointments and when using the schedule the appointment selection is constantly changed to the last updated appointment. This makes selecting and interacting with other appointments difficult. I won't rule out that my implementation may be incorrect, but I believe I have done well so far thanks to this forum.
5 Answers, 1 is accepted
Hello Clifford,
Thank you for the shared link.
My understanding is that you don't want the selected appointment to change while the appointments are updated. Feel free to correct me, if I am wrong and elaborate on the scenario.
I tested this on my end, however the selection is not changed with each appointment update. What I observed is that the selection is changed only when the selected appointment is removed to be updated, which is expected. That is why I am attaching the sample project that I used for testing. May I ask you to check it out and see how it differs from the setup on your end? Should you need any further assistance, can you modify the project in order to demonstrate your scenario and send it back in a new support ticket (since project files cannot be attached to forum posts)? This will hopefully allow us to investigate the scenario and better assist you.
Regards,
Vladimir Stoyanov
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/.
After reviewing your example and comparing our logic, I identified our issue. We were setting the SelectedAppointment of scheduleview downstream from our update method for the purpose of maintaining focus on the appointment we just edited. This was to counter your design as selection would shift to a different appointment in the collection once the initially selected appointment was removed for update. We'll remove that functionality as resolving our new issue is more important.
However, it still isn't clear to me exactly when and how the selection of an appointment is triggered. In your example project, I would click on a slot to take away focus from all appointments but eventually an appointment is set as selected again without my intervention. Can you explain this? I feel this may cause issues for us in the future.
Hello Clifford,
I am glad to hear that the sample project helped out.
As for the selection, by default the RadScheduleView synchronizes the current and the selected appointment of the CollectionView that it uses internally. When the selected item is removed, the current item is changed and in turn the selection is also changed. If you want to prevent this, you can create a custom AppointmentSelectionBehavior and set its IsSynchronizedWithCurrentItem property to False. Here is what I have in mind:
public class CustomAppointmentSelectionBehavior : AppointmentSelectionBehavior
{
public CustomAppointmentSelectionBehavior()
{
this.IsSynchronizedWithCurrentItem = false;
}
}
<telerik:RadScheduleView.AppointmentSelectionBehavior>
<local:CustomAppointmentSelectionBehavior />
</telerik:RadScheduleView.AppointmentSelectionBehavior>
I hope you find this information helpful. Let me know, if I can be of any further assistance.
Regards,
Vladimir Stoyanov
Progress Telerik
Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).