Scheduler week view

Hello,

I’m using the demo calender. There are no week numbers, how can I add them to my calender?
I also would like to know how I can change the default date, so that if I load the page I get the current date.

Regards,
Bas

Hi,
there is no option to display week number, but you can override week header template. It’s easier to do on the client-side
Default template is the followingscheduler.templates.week_date = function(d1,d2){ return scheduler.templates.day_date(d1)+" – "+scheduler.templates.day_date(scheduler.date.add(d2,-1,"day")); };

I also would like to know how I can change the default date, so that if I load the page I get the current date.
just remove following line
Scheduler.InitialDate = new DateTime(…);

if initial date is not specified, calendar will use current date instead

Hello,

Thanks for the reply.
If I remove the Scheduler.InitialDate = new DateTime(…); line, nothing changes. It seems like the page isn’t even loaded.

That’s strange, DHXScheduler.InitialDate is optional.
Anyway, you can assign current date explicitly Scheduler.InitialDate = DateTime.Today;

Hi,

Thanks Ill try that out.
I assume that the code for the week number needs to be changed in the dhtmlxscheduler_week_agenda.js javascript?

It’s better to override templates on your page, without modifying codebase(so changes won’t be lost if you update the component)
Common technique is to place custom code inside some function and call that function from configuration:
aspx:<script> function configure(){ scheduler.templates.week_date = ...; } </script> <%= Model.Render() %>c#: Scheduler.BeforeInit.Add("configure()");