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

Cannot read property 'uid' of undefined

1 Answer 647 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Kevork
Top achievements
Rank 2
Kevork asked on 25 Aug 2015, 01:15 AM

Hi,

 

My jobs are loading properly in the scheduler. And creating a job by double clicking on the scheduler and save from the popup is OK. But the problem is when I open the the newly created job and click Cancel button, nothing happens. I checked on the browser console. Error is "Uncaught TypeError: Cannot read property 'uid' of undefined"

 

In my case, "Job 101", "Job 10​2", "Job 10​3", "Job 104" are loading from back end. Suppose, I have just created a new job titled "Job 105" and when I open the job again by double clicking and click on Cancel button, error occurs, "Uncaught TypeError: Cannot read property 'uid' of undefined"

 

What am I doing wrong here?

 

@(Html.Kendo().Scheduler<TaskViewModel>()
    .Name("schedulerVertical")
    .Date(new DateTime(2015, 5, 27))
    .StartTime(new DateTime(2015, 5, 27, 7, 00, 00))
    .Height(600)
    .Views(views =>
    {
        views.DayView();
        views.WeekView();
        views.MonthView();
        views.TimelineView(t => t.Selected(true));
    })
    .Timezone("Etc/UTC")
    .Group(group => group.Resources("Techs").Orientation(SchedulerGroupOrientation.Vertical))
    .Resources(resource =>
    {
        resource.Add(m => m.TechID)
            .Title("Techs")
            .Name("Techs")
            .DataTextField("TechName")
            .DataValueField("TechID")
            .DataSource(d => d.Read("Techs", "Scheduler"));
    })
    .DataSource(d => d
        .Model(m =>
        {
            m.Id(r => r.TaskID);
            m.Field(r => r.TechID);
        })
        .Read("Vertical_Read", "Scheduler")
    )
)

 

public ActionResult Techs()
{
    List<Tech> techs = new List<Tech>
    {
        new Tech
        {
            TechName = "Jack",
            TechID = 1,
            Color = "#6eb3fa"
        },
        new Tech
        {
            TechName = "Lochlan",
            TechID = 2,
            Color = "#f58a8a"
        },
        new Tech
        {
            TechName = "Arefin",
            TechID = 3,
            Color = "#0583fa"
        },
        new Tech
        {
            TechName = "Faisal",
            TechID = 4,
            Color = "#9635a0"
        }
    };
 
    return Json(techs, JsonRequestBehavior.AllowGet);
}

 

public ActionResult Vertical_Read([DataSourceRequest] DataSourceRequest request)
{
    List<TaskViewModel> tasks = new List<TaskViewModel>
    {
        new TaskViewModel {
            TaskID = 1,
            TechID = 2,
            Title = "Job 101",
            Start = new DateTime(2015, 5, 27, 20, 00, 00),
            End = new DateTime(2015, 5, 27, 20, 30, 00),
            Description = "Description 101",
            IsAllDay = false
        },
        new TaskViewModel {
            TaskID = 2,
            TechID = 1,
            Title = "Job 102",
            Start = new DateTime(2015, 5, 27, 21, 00, 00),
            End = new DateTime(2015, 5, 27, 21, 30, 00),
            Description = "Description 102",
            IsAllDay = false
        },
        new TaskViewModel {
            TaskID = 3,
            TechID = 3,
            Title = "Job 103",
            Start = new DateTime(2015, 5, 27, 20, 00, 00),
            End = new DateTime(2015, 5, 27, 20, 30, 00),
            Description = "Description 103",
            IsAllDay = false
        },
        new TaskViewModel {
            TaskID = 4,
            TechID = 4,
            Title = "Job 104",
            Start = new DateTime(2015, 5, 25, 1, 00, 00),
            End = new DateTime(2015, 5, 25, 1, 30, 00),
            Description = "Description 104",
            IsAllDay = true
        }
    };
 
    return Json(tasks.ToDataSourceResult(request));
}
 

 

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Accepted
Vladimir Iliev
Telerik team
answered on 26 Aug 2015, 12:12 PM
Hi Kevork,

Please note that in order to enable CRUD operations for the Scheduler events you should define corresponding actions in both the Scheduler and the Controller. For more information on the matter you can check the following help article:
Regards,
Vladimir Iliev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Scheduler
Asked by
Kevork
Top achievements
Rank 2
Answers by
Vladimir Iliev
Telerik team
Share this question
or