i have a dhtmlXMenu when i right click on events,
in this menu i have links like “urgent” (instead of important), “Non affected”, etc…
when i click on one of these links, the event is updated on the view, if i click “urgent”, the event becomes red.
but it s not saved in the db.
i tried scheduler.updateEvent(event_id); with the good id, but it doesn t work.
i tried to call the “onAfterUpdate” event, but as it is after, nothing more happen…
but now i have another problem.
it seamt to me that it could be the same problem, but no…
when i drop an event from the dhtmlxtree in the scheduler, for now, it copy the event.
mercyDrag doesn t work.
i have found that this event was triggered after drop:
scheduler.attachEvent("onEventIdChange", function(old_id,new_id){
scheduler.deleteEvent(old_id,true);
});
but it doesn t delete. even if i had the call event with “onEventChanged”, it doesn t work.
do you have an idea what i am doing wrong?
When onEventIdChange event called, id of event was already changed from old_id to new_id. So there is no event with old_id anymore, so any api call with old_id value will not have effect.
because after i drag n drop an event in the scheduler, it is copied. so i have 2 same events after that.
and i saw that the onEventIdChange event was called when the drag n drop is done.
but you say the old_id doesn t exist anymore, but it s a copy, so the old and the new exists if i understand right, no?
Scheduler can’t hold two events with the same ID
If you will try to add the second event with the same ID, instead of adding the new one, scheduler will update the existing one.
When you drag item from the tree to the scheduler, scheduler will create a new event object, with new unique id, id of new item will not be related to the id of item in the tree ( you can use onExternalDrag event to catch the new id value )
thanks for your answer.
everything is ok with the new id and the new event.
what i want is to delete the old event. that’s all in fact.
i have the old id, but when i do “scheduler.deleteEvent(my_old_id);”, the event is still here.
ok, i checked it.
the event that is not deleted is displayed in a dhtmlxtree, and i don t see an event_id in the html of the tree.
but when i drag it on the scheduler, the good event is copied, so the event_id is somewhere there though.
after i drop the event, i see in firebug the 2 ids, the original, and the new one, copied from the first.
so i see what is the old id and the new one, i delete the event with the old id, and it is still here…
i think there is something i don’t understand.
there seam to be 2 ids, the event_id (like 12847382832) and the id of the event in the db(like 2).
when i do something like deleteEvent() or showEvent(), i use the id from the db, not the long id
what is this long id ? how can i get it ?
i think i understood why the deleteEvent() doesn t work.
because the list i try to drag the event from is a list of unassigned events, which are not displayed on the timeline. so i think it s the reason why it doesn t work.
is there a way to delete an event that is not displayed on the scheduler ?