How to copy event from button click and paste on click to calendar

Hi,

I need to understand how it is possible that if i have some button i.e ( copy ) .
On click to it… It should copy some specific event by ID and then one click on calendar it should paste the event.

any help?

Regards

Hi,

There is Keyboard Navigation that can help you to solve the issue:
https://docs.dhtmlx.com/scheduler/keyboard_navigation.html
Please check the sample https://docs.dhtmlx.com/scheduler/samples/03_extensions/07_navigation_plugin.html

Actually i am using this for normal copy ( ctrl + c ) paste ( ctrl + v ) by keyboard
But i was seeing this link before. I actually couldn’t understand how exactly i can make a trigger function that can use from a simple html button without needing keyboard shortcuts.

Like in my picture you will find the ( COPY ) button on top left side. Once i press this it should ask me to click on scheduler where i want to paste it.

Can u help me out ?

Regards

Try the next way:
when you click on the event that you want to copy, onClick API event fires. You can save properties values of this event
https://docs.dhtmlx.com/scheduler/api__scheduler_onclick_event.html
then click on copy button, that will wait for the click on the scale. And when it happens, call addEvent method and pass there saved properties values to create a copy.
https://docs.dhtmlx.com/scheduler/api__scheduler_addevent.html
You just need to change dates. There is getActionData() that can help you to return the current cursor-pointed date, and then set it as start_date of the event copy
https://docs.dhtmlx.com/scheduler/api__scheduler_getactiondata.html

Thanks for reply.

Yeah i was also thinking in same way.
So then if i need another button which is to ( MOVE ) event slot.
Then i have to get Event object and update its values by using cursor position on scale just after clicking it and then addEvent() will be used ? isn’t it ? just confirming.

Regards

Do you want to move an existing event with this button?

Yes basically i have two buttons one for (COPY) and one for (MOVE) move will move the whole event in same way we do CUT paste

Well its done now… Thanks @Polina