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

Bug or intended behaviour when modifying recurring series via drag drop.

1 Answer 17 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Cheryl
Top achievements
Rank 1
Veteran
Cheryl asked on 09 Jun 2020, 09:28 AM

Is this intended behaviour or a bug ?

In the Scheduler demo on your site (https://demos.telerik.com/aspnet-core/scheduler/index)

Screenshot 1

Add a recurring daily event that starts in the past sometime. My example: yesterday. 

 

Screenshot 2

Change one of the items in the past, so there is a recurrence exception for that day. My example: yesterday.

Then drag drop one of the events (on a future date) so it starts later in the day.  My example: tomorrow.
When the option comes up choose "Edit the series".

Screenshot 3
It then wipes out the previous events so in my example I have lost today and yesterday.

I assume that it is updating the start date of the event and emptying the recurrence rule, which is why this is happening, however it doesn't seem right to me.

I just want to change the event to start later for the whole series, I don't expect it to change the start date and remove recurrence exceptions.

 

Thank you.


1 Answer, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 10 Jun 2020, 05:22 AM

Hello Cheryl,

I am pasting here my reply from the support thread that you have opened on the same topic. It may be beneficial for other developers too:

The observed result is indeed intended by design. The same result will be present not only for recurring events starting in the past and spanning in the future but also for events which are entirely in the future. The reasoning behind this behavior is the following. When the user chooses to edit the entire series while moving an event around, the master event (the series starting event) will get the start and end DateTime from the slot(s) where the event has been dropped. That is the same as opening the recurring event edit pop-up in editing series mode and changing the start and end date and time.

As per how to ovoid the described, I assume that you would expect that only the Time part of the recurring event changes and the start Date remains the same. If that is the case, here is a possible approach to this scenario.

- Define global variables where you could store info about the event being edited:

var movingOccurence = false;
var previousStart = null;
var previousEnd = null;

- Handle the moveStart event of the Scheduler and obtain the required information if the event is an occurrence:

moveStart: function(e) {
if(e.event.recurrenceId) {
    movingOccurence = true;
 var masterEvent = e.sender.dataSource.get(e.event.recurrenceId);
    var masterStart = masterEvent.start;
    var masterEnd = masterEvent.end;
    
    previousStart = new Date(masterStart.getFullYear(), masterStart.getMonth(), masterStart.getDate());
    previousEnd = new Date(masterEnd.getFullYear(), masterEnd.getMonth(), masterEnd.getDate());
  }
},

- Handle also the save event and apply the required changes if the scenario is the discussed:

save: function(e) {
  if(movingOccurence) {
    movingOccurence = false;
    
    if(e.event.recurrenceRule && previousStart && previousEnd) {
      var changedStart = e.event.get('start');
      var changedEnd = e.event.get('end');
      var finalStart = new Date(previousStart.getFullYear(), previousStart.getMonth(), previousStart.getDate(), changedStart.getHours(), changedStart.getMinutes(), 0);
      var finalEnd = new Date(previousEnd.getFullYear(), previousEnd.getMonth(), previousEnd.getDate(), changedEnd.getHours(), changedEnd.getMinutes(), 0);
      
      previousStart = null;
      previousEnd = null;

      e.event.set('start', finalStart);
      e.event.set('end', finalEnd);
    }
  }
},

Here you could also find a small Dojo sample implementing the above:

https://dojo.telerik.com/aJevOwED/5

I would recommend you to carefully test the above approach of whether it covers the expected scenarios. It may need some adjustments according to your specific needs.

I hope that this helps. If you have any other questions, please do not hesitate to contact us.

Regards,
Veselin Tsvetanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Scheduler
Asked by
Cheryl
Top achievements
Rank 1
Veteran
Answers by
Veselin Tsvetanov
Telerik team
Share this question
or