Default start date to current date in day view

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() { ... }

… but I wasn’t sure what value/expression to use to get the day view date. Any help is appreciated!

Hello,

here is default template:

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.

Thanks for your help!

Chris

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};
};

Has this template changed? I don’t see documentation for new_event_data, and it doesn’t seem to work for me, even in its simplest form:

scheduler.templates.new_event_data = function(){
return {text:‘text test’};
};

I expect to see ‘text test’ in the form first form field.

I’m putting it before the line that says dhx.ready(function…). Is there anything else I need to know?

Hi,

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).

Can you please send me the development version? If it helps, we are an enterprise customer.
Thanks