This is a migrated thread and some comments may be shown as answers.

Cannot read property 'getHours' of undefined

1 Answer 512 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Brad
Top achievements
Rank 1
Brad asked on 14 Aug 2017, 11:04 PM

getting the error in the title when i try to view any 'view' of the scheduler other than 'month'.  Below is my scheduler code:

@using Kendo.Mvc.UI;
<div>
    @(Html.Kendo().Scheduler<CoBRAMVC4Portal.Areas.Admin.Models.ExerciseCalendarModel>()
    .Name("exSched")
    .Date(System.DateTime.UtcNow.Date)
    .Views(views =>
    {
        views.DayView();
        views.WorkWeekView();
        views.WeekView();
        views.MonthView(monthView => monthView.Selected(true));
    })
    .Timezone("Etc/UTC")
    .Editable(false)
    .Group(group => { group.Resources("ExerciseGUID"); group.Date(true); })
    .DataSource(d => d
        .Model(m =>
        {
            m.Id(f => f.ProjectGUID);
            m.Field(f => f.ExerciseLevelGUIDs);
            m.Field(f => f.IncidentCategoryGUIDs);
        })
        .Read(read => read.Action("_GetExerciseListCalendarAsDates", "Exercise", new { area = "Admin", id = ViewContext.RouteData.Values["id"] }).Type(HttpVerbs.Get))
        )
        .Events(e =>
        {
            e.DataBound("scheduler_dataBound");
            e.DataBinding("scheduler_dataBinding");
        })
        .EventTemplate("<div class='media' style='margin:0px;'>" +
                    "<div class='media-body' style='padding:5px 0 0;margin:0px;'><h5 title='#=title#' style='padding:0 8px 5px;margin:0px;' class='media-heading'>#= title #</h5></div>" +
                    "<div class='media-right'><a class='btn btn-default btn-xs' title='" + CoBRALocalization.MVC.RootResource.OpenLink + "' href='" + Url.Action("ExerciseView", "Exercise", new { area = "Admin" }, Request.Url.Scheme) + "?StaticGUID=#=StaticGUID#' >" +
                    "<span class='fa fa-folder-open'></span></a></div>" +
    "</div>")
    )
</div>
<script>
    function scheduler_dataBound(e) {
    }

    function scheduler_dataBinding(e) {
        //Handle the dataBinding event.
    }
</script>

everything works fine in the month view

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 16 Aug 2017, 01:09 PM
Hello Brad,

From the provided configuration I cannot see any resources definition. Group.resources should be defined when grouping by date:
.Group(group => { group.Resources("Owners"); group.Date(true); })
.Resources(resource =>
{
resource.Add(m => m.OwnerID)
 .Title("Owner")
 .Name("Owners")
 .DataTextField("Text")
 .DataValueField("Value")
 .DataColorField("Color")
 .DataSource(source =>
 {
       source.Read(read =>
  {
  read.Action("GetSections", "Calendar");
  });
});
})

I am also attaching a sample MVC application for your reference, where the above is demonstrated.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Scheduler
Asked by
Brad
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or