Mobile Scheduler - update the event id

Hi,

We’re not using the data processor that comes with the scheduler. Right now, we have a bug that I’m hoping you can help with.

If I add an event, the scheduler updates with the event, and then I call our own method via json to add the event to our database.

If I then try to delete the event, it deletes fine from the scheduler UI, but it does NOT delete from the database because the id the scheduler is storing is NOT the same as the database id.

To address this, I tried 2 things.

  1. Calling $$(“scheduler”).load AFTER I added the contact, so the scheduler would refresh and have the correct ID. The result was TWO identical events on the scheduler.

  2. Then I tried updating the id of the event after a successful database add. I tried this two different ways.

id = $$("scheduler").$$("id").getValue(); $$("scheduler").item(id).id = data['new_id'];

And

$$("scheduler").$$("id").setValue(data['new_id']);

After that, if I do this: alert($$(“scheduler”).$$(“id”).getValue()); the correct ID is returned.

However, when I do a delete, the id that goes into the delete function is the OLD ID.

[code] $$(“scheduler”).data.attachEvent(“onAfterDelete”,function(id){
delete_event(id);
dhx.alert(“Event has been deleted”);
return true;

        });[/code]

Please help!

Thank you,
Rachel

Try to use

$$("scheduler").data.changeId(old_id, new_id);

This is the correct way to change data item id.

Perfect! Thank you so much.