Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jamie on Aug 26, 2009 13:18
open dhtmlx forum
dhtmlxScheduler - update event on calendar

I'm using a custom lightbox for updating the calendar events. The code I'm using to update the event itself is as follows:

var startDate = new Date(event_start_year, event_start_month, event_start_day, event_start_hour, event_start_minute);        var endDate = new Date(event_end_year, event_end_month, event_end_day, event_end_hour, event_end_minute);
        
scheduler.setEventText(event_id, heading);
scheduler.setEventStartDate(event_id, startDate);
scheduler.setEventEndDate (event_id, endDate);


The event text gets updated correctly, but the date change doesn't get reflected until the page is refreshed and the events are pulled from the database again. Is there something I'm missing for changing the data automatically?
Answer posted by Support on Aug 27, 2009 06:04
There was an issues, which can cause incorrect event position rendering when new date of event is outside of current viewable area. 
Fixed version is attached to the post. 
Attachments (1)
Answer posted by Jamie on Aug 27, 2009 11:27
Now when the event date is changed the event simply disappears from the view at all even if I only change the date by 1.  For instance, I'm viewing the calendar for August in month view and a single event.  It starts on August 27 and I change it to August 28th.  When I save, the event simply disappears from the calendar all together until the page is reload.  What is the proper format of the setEventStartDate function's second parameter?  I thought passing it a valid date object would work, but apparently not.  Can you give me a specific example using the code from my original question?  Thanks!
Answer posted by Support on Aug 28, 2009 02:19
With updated codebase, the logic is next

if new start and end date of event is inside the visible area - event repainted on the view
If dates of event are outside of viewable area - event cleared from current view. ( but it will be visible if you go the date of event ) 

>> What is the proper format of the setEventStartDate function's second parameter?
Command expects the javascript date object

>> It starts on August 27 and I change it to August 28th. When I save, the event simply disappears from the calendar all together until the page is reload.
If you are in the "day" view - it is correct behavior, because event date is outside of active view , but event must be visible when switching to the next day or into the "week" view. 

>>I thought passing it a valid date object would work, but apparently not.
It must be enough - just be sure that you are not sharing the same date object between different events. 
Also, beware that month parameter inside the Date constructor is zero based - it can be a reason of confusion. 

Sample is attached
Attachments (1)
Answer posted on Sep 08, 2009 10:56
Yes, my problem was related to the date object being zero based.  A little simple addition in the JS and voila, all is working perfectly.  Thanks for the assistance.