Error on custom view

I created a custom view for a work week.
C# class:
public class WorkWeekView : SchedulerView
public WorkWeekView() : base()
// view type must be equal to the one defined on the client
Name = ViewType = “workweek”;
Label = “Work Week”;
TabWidth = 75;

Added it to the controller method:
var scheduler = new DHXScheduler
Skin = DHXScheduler.Skins.Terrace,
Config =
first_hour = 6,
last_hour = 24,
readonly_form = true,
separate_short_events = true,
preserve_scroll = true,
collision_limit = 1000,
cascade_event_count = 1000,
LoadData = true,
DataAction = Url.Action(MVC.Calendar.Calendar.Data()),
var workWeekView = new WorkWeekView();
if (!string.IsNullOrEmpty(Current.CalendarView))
scheduler.InitialView = workWeekView.Name;
scheduler.Data.Loader.AddParameter(“emails”, string.Join(";", emails.ToArray()));

added methods to the view:
$(document).ready(function () { = function(date) {
scheduler.templates.workweek_date = scheduler.templates.week_date;
scheduler.templates.workweek_scale_date = scheduler.templates.week_scale_date;
scheduler.attachEvent(“onTemplatesReady”, function () { =;
scheduler.templates.workweek_date = scheduler.templates.week_date;
scheduler.templates.workweek_scale_date = scheduler.templates.week_scale_date; = function (date, inc) { return, inc * 7, “day”); } = function (date) { return, 5, “day”); }


When ever I try to load the scheduler using the work week view I get this error:
Uncaught TypeError: Cannot read property ‘0’ of undefined
at Object.scheduler.render_view_data (:165:336)
at Object.scheduler.update_view (:103:108)
at Object.scheduler.updateView (:106:97)
at Object.scheduler.setCurrentView (:106:378)
at Object.scheduler.init (:70:340)
at :22:12
at hr (jsForBootstrapLayout?v=Pmpt5ePOaigko8j8eGgjtGdrplxmTiABXFUIyA162h41:1)
at ot (jsForBootstrapLayout?v=Pmpt5ePOaigko8j8eGgjtGdrplxmTiABXFUIyA162h41:1)
at i.fn.init.append (jsForBootstrapLayout?v=Pmpt5ePOaigko8j8eGgjtGdrplxmTiABXFUIyA162h41:1)
at i.fn.init. (jsForBootstrapLayout?v=Pmpt5ePOaigko8j8eGgjtGdrplxmTiABXFUIyA162h41:1)

What am I missing?


Probably the error has to do with the markup of scheduler container.
Please make sure that the scheduler container has dhx_cal_navline, dhx_cal_header and dhx_cal_data elements:

[code]<div #scheduler_here class=“dhx_cal_container” style=“width: 100%; height:100vh”>


If this doesn’t help to solve the issue, please reproduce the issue in the snippet , than click on ‘Share’ and send me a link.

The container has all those classes, I am using the DHXScheduler for .Net so it’s rendered properly. I see the Work Week tab, I can click on it and it’s rendered fine, but then when I call the .net controller again with the option for the work week to be the initial view instead of the week one I get the reported error…

I am not sure how am I supposed to replicate the behavior of the .net code using the page you sent me…

As I see you have set the same configurations in

$(document).ready(function (){....} 


scheduler.attachEvent("onTemplatesReady", function () {

Possibly it causes the problem.

I tried with each section commented out, and both of them commented out and the error is still there. It’s either the schduler.InitialView from the controller not working, or I have to do something more in the javascript code, but I don’t know what. I added all the methods that the tutorials recommended…

Hi there :slight_smile:

Did you received an answer ?

My related problem seems similar :

Please feel free to share a solution if you got one :wink:

Hi micka,

Check my reply in your topic.