strange behavior for copy 'n paste

Hello,

I am using copy 'n paste (ctrlC and ctrlV) in month view. This works fine EXCEPT, when the event is pasted the event description says “00:00” and when I double click pasted event I see the correct start/end times have been pasted and it is only when I save in Lightbox and then exit that the correct start time appears in the event instead of “00:00”.

Many thanks in advance if you have any ideas.

Cheers,

Hi
pasted event recieves start date based on mouse position. Month view does not allow pointing to specific time of day, mouse position is always resolved as 12am of selected day.
Currently, nothing can be done to change this behavior. Scheduler doesn’t throw any events that would allow to modify event date before pasting it.
We’ll add appropriate events by next update of the component

Hi and thanks for your response. Wouldn’t there be a way to check if we are in Month view, if so, then instead of using Mouse pointer position, get the event start_date and use that instead?

I guess I would like to be able to make and exact copy of the event, in Month view and paste it in another day.

Best,

You can use something like

[code]scheduler.attachEvent(“onEventPasted”, function(copy, event, origin){
//restore hours, same as in original event
event.start_date.setHours(origin.start_date.getHours);
event.end_date.setHours(origin.end_date.getHours);

 //restore minutes, same as in original event
 event.start_date.setMinutes(origin.start_date.getMinutes);
 event.end_date.setMinutes(origin.end_date.getMinutes);

 //repaint event
 scheduler.updateEvent(event.id);

});[/code]

Hi

I have tried your code, but the paste doesn’t work at all when I add it (CTRL-V doesn’t even paste the event with 00:00)…

Any ideas?

Thanks again!

Hello,

I wanted to let you know this now works. I changed your code as below. Basically:

event.start_date.setHours(origin.start_date.getHours); --> event.start_date.setHours(origin.start_date.getHours());

Thanks again for your help!!

Cheers,

[code] scheduler.attachEvent(“onEventPasted”, function(copy, event, origin){
//restore hours, same as in original event
event.start_date.setHours(origin.start_date.getHours());
event.end_date.setHours(origin.end_date.getHours());

     //restore minutes, same as in original event
     event.start_date.setMinutes(origin.start_date.getMinutes());
     event.end_date.setMinutes(origin.end_date.getMinutes());

     //repaint event
     scheduler.updateEvent(event.id);
});[/code]

I wanted to let you know this now works. I changed your code as below
Yep, was a my typo. Sorry for inconvenience.