Hello, I was wondering how to default the start date of a new appointment to the date currently selected in the day view. I’m assuming I can set it in:
scheduler.templates.new_event_data = function(){
var d = dhx.Date.add(new Date(),1,“hour”);
var start = new Date(d.setMinutes(0));
var end = dhx.Date.add(start,1,“hour”);
return {start_date:start,end_date:end};
};
So, the template should return an object with default properties for a new event.
Sorry Alexandra, my original question probably wasn’t clear. I don’t want to default the start date to the current date. I want to default the start date to the date currently displayed in the day view of the calendar. So today is 3 December, but if I’m viewing the calendar for the day of 15 January 2012 and I click the + sign, I want the start date to default to 15 January. I’m just not sure how to get the date being displayed in the day view of the mobile scheduler.
The active date can be got by the $$(“scheduler”).coreData.getValue() method:
So, you can try the following:
scheduler.templates.new_event_data = function(){
var d = dhx.Date.add($$(“scheduler”).coreData.getValue(),1,“hour”);
var start = new Date(d.setMinutes(0));
var end = dhx.Date.add(start,1,“hour”);
return {start_date:start,end_date:end};
};
new_event_data template is not included into the official version. It is the feature for the next scheduler version. The dev version of the new scheduler was sent to some customers. However, the official version is going to be released soon (within 1-3 weeks).