This is a migrated thread and some comments may be shown as answers.

Change Category of Occurrence

2 Answers 74 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
heavywoody
Top achievements
Rank 1
heavywoody asked on 15 Apr 2015, 12:05 AM

So I am trying to figure out how to change the category of an occurrence. Lets say a custom has an appointment every wednesday at 1pm.  When they make the appointment, I will mark that occurrence as Blue. If they miss the appointment, I mark the occurrence as Red.

I was looking at sourcecode of ScheduleView and it seems an occurrence is nothing more then the original appointment with the occurrence start and duration added to the object, which makes up the Occurrence object.  So if I change the Category of one,it changes them on all because it is really the same Appointment object with just different dates.  So is there anyway to treat an Occurrence like a unique object that you can change Category or properties of, but it still stays part of the RecurrencePattern?

 Or is it possible on an appointment, when you call GetOccurrences, the return custom appointments that have more properties?

On an Occurrence, I don't see the different between the appointment and the Master. 

 

2 Answers, 1 is accepted

Sort by
0
heavywoody
Top achievements
Rank 1
answered on 15 Apr 2015, 01:03 AM

I wanted to add that after writing this post, I did much more reading and I think from some other answers I can see a way to do this.  So when an occurrence has passed, I can actually just turn that into its own Appointment and give it a color.  I would want to lock it as well so it cannot be deleted.  It becomes historical.  I think that would work fine.  I was thinking of adding an exception to the rule, but that could get pretty big.   So I was thinking of doing something like this and see what you think:

 1) Once an occurrence of an appointment has pasted, I would create a new Appointment for that occurrence and give it a category.

2) I would then also change the recurrencepattern dynamically so the appointment always starts from the moment the last occurrence finished, so that there is never an occurrences in the past.  They are all now separate instances.

I do see a problem.  If I am setting maximum occurrences, that would no longer work unless I dynamically update that as well.

Is it easy enough update the recurrencepattern and have it update automatically or would I have to refresh?   Or do you have a better suggested way of doing what I am talking about?

 

0
Vladi
Telerik team
answered on 16 Apr 2015, 10:49 AM
Hello,

All of your remarks about what an recurring appointment is are correct. When customizing the Appointment of an recurring appointment's occurrence all of occurrences will be updated as they share the same "parent" appointment. In the RadScheduleView control when customizations to a single occurrence are desired the way this is achieved is by making an exception appointment and adding it to the ReccurenceRule of the appointment. More details about recurrences and exceptions can be found in our online documentation here.

Let me respond to your followup post:
In the given example it sound correct to do the mentioned implementation of creating a separate recurrence rule (for the passed appointments) and updating the currently "active" recurring appointment by its ReccurenceRule. This approach looks like it would achieve the exact desired behavior but it would require some custom implementation. A different approach possibly could be to implement such a behavior with the use of the mentioned exceptions to the ReccurenceRule.

Unfortunately currently we do not have an example which demonstrates creation of exceptions at runtime outside of the controls built-in functionality. As we see such example could be useful we will review the possibility of adding such example to our SDK repository at GitHub.

Regards,
Vladi
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
ScheduleView
Asked by
heavywoody
Top achievements
Rank 1
Answers by
heavywoody
Top achievements
Rank 1
Vladi
Telerik team
Share this question
or