update event programmatically and send changes to the server

Hi !

I have a scheduler with dataprocessor enabled like this :

scheduler.setLoadMode("day"); scheduler.load("/ajax/ajax_get_rdvs.php","json"); var dp = new dataProcessor("/ajax/ajax_get_rdvs.php"); dp.init(scheduler);

I have a contextMenu wich from the user can change the end date of an event. When I change the event property end_date I’m doing :

var s_date_e = new Date(the_date.getFullYear(),the_date.getMonth(),the_date.getDate(),hame.hours,hame.minutes,0,0); var e_date_s = new Date(the_date.getFullYear(),the_date.getMonth(),the_date.getDate(),hpms.hours,hpms.minutes,0,0); ev.start_date = s_date; ev.end_date = s_date_e; ev.missed_hours_reason= missed_hour_reason; scheduler.updateEvent(ev.id);
And, from the documentation :

The event is correctly rendered in the scheduler, but the dataprocessor does not update the event on the server side.

Any clue on this issue ?

Thanks in advance

Hi,
the “scheduler.updateEvent()” only renders the event in the scheduler, so makes the changes visible. It doesn’t send any data to the server-side. To do this you can call “onEventChanged” event:

scheduler.updateEvent(ev.id); scheduler.callEvent("onEventChanged", [ev.id, ev]);
docs.dhtmlx.com/scheduler/api__s … event.html
And the dataProcessor will catch it and will update the data on the server.

1 Like

It works perfectly, thanks a lot !

Excellent!!
I was also having same kind of problem, this worked perfectly for me also :slight_smile:

Thanks :slight_smile: