Schedule programatically change start date

Hello!

I want to change the start date of an event by code, after the showing of the calendar, where user picks the date and time, and display it on the event tab.
The problem i get is that I can’t seem to find the right event for that.

I tried to change the startDate on ‘OnViewChange’, but nothing happened.
I tried to change it on ‘.webixtype_base’.click (the class for the validation button), but once again, nothing happened.

Is there any place I could add this behaviour I want?

Also tried in onViewShow with no result…

Hello,

try to use updateItem method:

var eventId = ...;
$$("scheduler").updateItem(eventId,{id: eventId, start_date: new Date(2015,5,11)});

I am not sure I understand what you mean.

What is eventId? in my case is “form” ?
Also, i want to change the date when i leave the “formdate” view, so when should I call that code you provided? onViewChange (with a validation for view1==formdate and view2 == form) will work?

On a side note, i observed that when I return to my form view from formdate, even if the date shown in ‘Start date’ is not the desired one, if I alert something like: $$(‘scheduler’).$$(‘start_date’).getValue() i see the corect value.

eventId is the id of an event that you want to update.

The id of the selected event can be got by getCursor() method:

var id = $$(“scheduler”).getCursor();

Also, i want to change the date when i leave the “formdate” view, so when should I call that code you provided?

The date should be changed automatically. Please provide details about the issue - how can I reproduce the problem ?