AppointmentLoaded event not called for spanned appointments

I'm using the AppointmentLoaded event to feed custom views for appointments to the schedule Control. This works fine for most appointments (even all-day ones), but it seems that the event is NOT called for appointments that are spanned (e.g. start the evening before). Is this a bug? If not, how can I work around that?

Thanks,
Olaf

5 Replies

VR Vigneshkumar Ramasamy Syncfusion Team October 10, 2018 07:18 AM UTC

Hi Olaf Bartelt, 
 
Thanks for contacting Syncfusion support. 
 
We have analyzed the query with “AppointmentLoaded event is NOT called for appointments that are spanned” and which is working fine from our side. We have prepared a sample by loading custom view for the spanned appointment and please find the sample from the below link. 
 
Sample Link: SpannedAppointment
 
 
In case, if you are still facing the issue from your side. Please modify the attached sample to reproduce the issue which will be helpful for us to validate the issue and provide you the solution at earlier.  
 
Please let us know if this helpful. 
 
Regards 
Vigneshkumar R 



OB Olaf Bartelt October 10, 2018 09:29 AM UTC

You're right, it works in your sample. Though I meant "spanned" in the way that the appointment is displayed in 2 consecutive days in week view (e.g. starting yesterday at 23h and ending today at 10h). What's funny is that a) I can click such an appointment, but CellTapped is not being called (though it gets a selection border) and b) that sometimes (like in your sample) the appointment is only displayed in the all-day area (like also stated in the documentation, if I'm not mistaken).

Maybe the bug (though preferred behavior to me) is that it's not displayed in the all-day area but in 2 days in the time slots? Though I've been able to reproduce that behavior in your sample as well, but there it works fine :-(  I checked working and not working appointments but cannot seem to find any difference. Any idea of what else I could check?

EDIT: two observations:

1. In the sample app, if I subscribe to CellTapped, it's only called for cells without appointments in them, in my app it's called for both.
2. If I don't assign custom views (even UIButtons) in AppointmentLoaded, it's called for that "offending" appointment as well. So maybe there's some kind of exception going on that breaks a loop or something?

EDIT 2: the problem is a different one. I have a custom class subclassed from ScheduleAppointment, which I put into a list and feed that as ItemSource to the schedule control. In case of the "offending" appointment, it's suddenly the base ScheduleAppointment class, not my one one. How can that be? Do you transform it/create a new one somewhere? Maybe it's got to do with the behavior I described above (that the appointment is not displyed in the all-day area, but as two different blocks inside the time slots of 2 consecutive days)? Would make sense to me ;-)

EDIT 3: found it (sorry for using ILSpy, but I need to find a solution ;-)). It's due to Syncfusion.SfSchedule.iOS.AppointmentEngine.GetVisibleAppointments. There, the appointment is splitted into 2 if it spans across days. I've implemented a workaround using reflection for now, but is there any other way I could access ScheduleAppointment.Id? There, my custom object is stored, for whatever reason.


VR Vigneshkumar Ramasamy Syncfusion Team October 12, 2018 11:34 AM UTC

Hi Olaf,  
 
Query 1: Regards the CellTapped Event:  
Schedule CellTapped event always fire even the cell contains appointment, while using custom view for appointments if you use the view like button or anything that has the touch operations you must disable the UserInteractionEnabled property to trigger the schedule CellTapped event.  
  
void Schedule_AppointmentLoaded(object sender, AppointmentLoadedEventArgs e)  
{  
    var button = new UIButton(UIButtonType.System);  
    button.SetTitle(e.Appointment.Subject, UIControlState.Normal);  
    button.BackgroundColor = UIColor.Green;  
    button.UserInteractionEnabled = false;  
    e.View = button;  
}  
  
If you used Label as a custom view then it’s not required to set the UserInteractionEnabled property as false, as it doesn’t have any inbuild touch operations.  
  
Query 2: Regards Appointment display  
We have displayed the spanned appointments in two types based on it’s duration, if the appointments duration is less then 24 hour it will split into the time slots, if it’s duration more then 24 hour it will be placed on the All-day panel of the corresponding days  
  
Query 3: Regards Appointment Loaded Event not triggered for Spanned Appointment and Triggers for “offending” appointment  
We have unable to reproduce the “Appointment Loaded Event not triggered for Spanned Appointment” which has duration less than 24 hour we have modified the sample as the way you mentioned, and it works fine with this.  
The appointment loaded event always triggers for all the VisibleAppointments in the view, we are not understanding your query that the event triggers of “offending” appointment as well please provide more details on this which help us to analyze and resolve this.  
  
Query 4: Regards Custom Appointment type changed as ScheduleAppointment in some cases  
We able to reproduce the“Custom appointment type changed to schedule appointment in some cases” issue and we have logged a bug report for the same, this will be included in our upcoming Volume 3 SP1 release, which will be expected to roll out on end of October 2018, we appreciate your patience until then.  
  
Sample:   
   
Regards,  
Vigneshkumar R 



OB Olaf Bartelt October 12, 2018 01:35 PM UTC

Query 1: yeah, I figured that myself, never mind! ;-)

Query 2: makes sense, thanks for clarifying!

Query 3: as I said, the problem lies in splitting/creating a new ScheduleAppointment instance that is not of my subclassed type and has the extra information I need (s. Query 4)

Query 4: perfect, thanks! For now, I've implemented a workaround in getting the Id property by reflection, which contains my original object. Works for now!


VR Vigneshkumar Ramasamy Syncfusion Team October 15, 2018 12:51 PM UTC

Hi Olaf 
 
Regarding 3rd query also related with the issue “Custom appointment type changed to schedule appointment in some cases” and as mentioned in the previous update, this fix will be included in our upcoming Volume 3 SP1 release, which will be expected to roll out on end of October 2018, we appreciate your patience until then.   
 
Regards 
Vigneshkumar R 


Loader.
Up arrow icon