[Scheduler unit view] scheduler.Templates.hour_scale issue

Hello,

I have increased the hour_size_px value to 4x to display 15 minute increments better. Now I need to show those 15 minute increments on the left hand time scale.

I know how to edit the scheduler.Templates.hour_scale template but I need to know how to reference the date so that it will show properly.

I know in javascript you do something like this:

var format = scheduler.date.date_to_str("%h %i %A");

scheduler.templates.hour_scale = function(date){
return format(date);
};

but how do you do it in C# in an MVC project? Where does the date come from?

Thanks

Hi,
it would be easier to do such config in JS, rather than using c# scheduler template api

c#:
create js file where you’ll define js configs and templates and attach it to the scheduler as an extension, e.g. screencast.com/t/9j63GIVdZ
File will be loaded after dhtmlxscheduler files and before initialization of scheduler:

var scheduler = new DHXScheduler(this); scheduler.Extensions.Add("../scheduler.js");// path relative to Scripts/dhtmlxScheduler folder

scheduler.js:

[code]scheduler.attachEvent(“onSchedulerReady”, function () {

var format = scheduler.date.date_to_str("%h %i %A");
scheduler.templates.hour_scale = function (date) {
    return format(date);
};

});[/code]

cs api also supports some templating and template variables can be referenced as {date} and formatted using :date{format} method: scheduler.Templates.hour_scale = "{date:date(%h %i %A)}";
but as for now, defining templates from js looks like a more viable approach since you’ll need to do js coding for complex templates or logic anyway

Worked well, thanks.