Duplicating dynamically added event on click

Hi ,

I have my situation where i want help to understand the problem
First let me explain my case. This could be a little long


These are the events registered in my database and showing on scheduler.

So what i need is… that if someone click any event it should gets duplicate with same date and time like in below screen shot.


which is working fine it is getting duplicated and saved into database as a new entry…
with these details in console.

Now my problem is with dynamically added new Event in scheduler with some button and using addEvent() method which has no database record entry.


Like in above screen shot there is my first event with text ( WORKING ) and other are also there with no text.

So when i click any of them they should also work. But they aren’t .

Instead of sending correct details it is getting random date and time automatically and in console what i noticed is that the SCHEDULER id is different in OnEventAdded function and while sending in request is different. . if you go little up and compare these console screen shot with first you will see the difference better.


in above first screen shot tells you my accurate data but in request this is going like empty… something is overriding it in this case where we are clicking dynamically created event after scheduler load.

How this is getting different i have no clue. can any one tell ?

This is how i’m duplicating the events:-

  scheduler.attachEvent("onClick", function(id, e)
var ev=scheduler.getEvent(id);
var newtemp={


return true;



It is difficult to guess what goes wrong. I tried to reproduce and event is created correctly, but I can’t check the request to the server.

Check if xml_date configuration corresponding to the date format that you sent to the server.

If you can share complete demo that I can run locally - it could help me to investigate the issue.

Hi Dear,

I’m uploading my problem project for you on below link

So first you will see this

In this i have made some events stored in database.
If we click any of them it will work. Like in below screen shot

Next You will find a button on top for getting dynamic events which will be created on scheduler without saving into database. In below screen shot you will find some new dynamic events.

Now Problems starts from here.
If you click any one of them. Like i am clicking the last one

You will see it is doubled with same ONCLICK text event. But actually what happened is that It has created a new slot if you will refresh the page like in below screen shot.

The above screen shot is after page refresh and you will find a newly created entry with that same text of dynamic event. I really don’t know how this is happening… This is going into the onclick method where i have set the text as ONCLICK like you’ve seen in first example…

So from now on without REFRESHING the page if i click any event no matter if it is saved in db or it is a dynamic… This problem will repeat.

You can also check the console logs I’ve set for you.

Also you can delete current view events from top button if you test it.

i hope you will have answer for me… Thanks in advance.


Hi I’m waiting for anyone’s reply.

Hi @Polina.
I want to know if you have checked this issue please.?



You don’t need to call scheduler.updateView() after addEvent() method in the getdynamicEvent function.

As for the issue - it is not very obvious what goes wrong, and I can’t see event id in the console when onBeforeUpdate fires. I think the issue related to the value of “can_update” flag. Probably changes of the variable are not always expected.

Try to add “can_update” property to the event object and use its value in the onBeforeUpdate directly.

Thanks for the reply.

Yeah for the updateView() function you are right… It is not necessary.Any way.

Ok as i’m working on other things right now…
Meanwhile let me explain it more precisely why do i need this to work.

My actual issue was. I have a front end calendar and one is on back end.
So what i need is LIVE UPDATE to work with dynamic events and it triggers when you use addEvent() while allowing database saving in BEFOREUPDATE event.

  • My backend calendar is empty.
  • My frontend calendar has some MARKTIMESPANS which creates dynamic events from its starting date and time and ending date time… i.e if a marktimespan is starting from 2pm - 6pm … On frontend 4 dynamic events of 60 minutes without saving into database… will be created.

So at this point i need something like if i click on any of the event. It should create an event immediately in my backend calendar as LIVE UPDATE works.

But in LIVE UPDATE we basically need to create event normal by dragging or with addEvent().

But here in this way… when we click on any event this will take date time of it and remove this and creates another one on its place by saving into database so the LIVE update could trigger and show event in backend calendar.

So to achieve this thing i had to do work like this way because LIVE updation work as far as i searched about it only if your addEvent() into database.

So if there is any other way to achieve this please tell me.
I’ll be very thankful to you.


Did you try to replace the “can_update” flag with event property?


Well thanks for the suggestion. I was able to manage with your suggestion and a little more change in my code flow.