Duplicating dynamically added event on click


#1

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

24%20AM

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.

20%20AM

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

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

20%20AM

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.

46%20AM

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={
  start_date:ev.start_date,
  end_date:ev.end_date
  text:'working...'
};

scheduler.addEvent(newtemp);

return true;
                });

Regards


#2

Hi,

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.
http://snippet.dhtmlx.com/ad09ee4e7

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.


#3

Hi Dear,

I’m uploading my problem project for you on below link
http://dhtmlx.enara.xs4arabia.com/liveupdate-cl.php

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
31%20AM

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.

Regards


#4

Hi I’m waiting for anyone’s reply.


#5

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

Regards