Hello,
I have some troubles about resources in scheduler, so I come here to find some help.
I want to make a scheduler for some employees. For a better readability, I would like that every user's event has a unique color. Colors are stored in database, on with all User's data. So I decided to use Resources to do this.
However, when I define a remote loading for resources, then scheduler raise on error (see below) and stop working.
Here is Razor code :
@(Html.Kendo().Scheduler<EventViewModel>()
.Name("calendar")
.Date(DateTime.Now)
.Timezone("Etc/UTC")
.Views(v =>
{
v.DayView();
v.WeekView(conf => conf.Selected(true));
v.MonthView();
v.AgendaView();
})
.DataSource(source => source
.Model(conf =>conf.Id(f => f.EventId))
.AutoSync(true)
.Read("GetAllEvents", "Activity")
.Create("CreateEvent", "Activity")
.Destroy("DestroyEvent", "Activity")
.Update("UpdateEvent", "Activity")
)
.Resources(resources => resources.Add(m => m.Creator)
.Title("User")
.DataTextField("Name")
.DataValueField("UserId")
.DataColorField("Color")
.DataSource(source => source
.Read(read => read.Action("GetUsersList", "Activity"))))
)
If I remove .Resources() part, all is working great. Defining some static resources (with .BindTo(new[]{...})) works well too, but this way is not handy.
Finally, when I want to define a resources section with remote loading, I got the following error messages in FireFox :
TypeError: t is undefined @ /Scripts/kendo/2013.2.716/kendo.all.min.js:31
TypeError: n.slice is not a function @ /Scripts/kendo/2013.2.716/kendo.all.min.js:11
Users list is perfeclty loaded in my page. Here is GetUsersList() code :
public ActionResult GetUsersList([DataSourceRequest] DataSourceRequest request)
{
var items = from x in db.Users
select new {x.UserId, Name = x.FirstName + " " + x.LastName, x.Color};
return Json(items.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
One thing I notice is that, when resources are loaded up, scheduler does not trigger any loading for events. I'm not yet used to scheduler helper, so it's not really easy to understand what issue is.
Thanks you for your help.
Best Regards,
Claude
I have some troubles about resources in scheduler, so I come here to find some help.
I want to make a scheduler for some employees. For a better readability, I would like that every user's event has a unique color. Colors are stored in database, on with all User's data. So I decided to use Resources to do this.
However, when I define a remote loading for resources, then scheduler raise on error (see below) and stop working.
Here is Razor code :
@(Html.Kendo().Scheduler<EventViewModel>()
.Name("calendar")
.Date(DateTime.Now)
.Timezone("Etc/UTC")
.Views(v =>
{
v.DayView();
v.WeekView(conf => conf.Selected(true));
v.MonthView();
v.AgendaView();
})
.DataSource(source => source
.Model(conf =>conf.Id(f => f.EventId))
.AutoSync(true)
.Read("GetAllEvents", "Activity")
.Create("CreateEvent", "Activity")
.Destroy("DestroyEvent", "Activity")
.Update("UpdateEvent", "Activity")
)
.Resources(resources => resources.Add(m => m.Creator)
.Title("User")
.DataTextField("Name")
.DataValueField("UserId")
.DataColorField("Color")
.DataSource(source => source
.Read(read => read.Action("GetUsersList", "Activity"))))
)
If I remove .Resources() part, all is working great. Defining some static resources (with .BindTo(new[]{...})) works well too, but this way is not handy.
Finally, when I want to define a resources section with remote loading, I got the following error messages in FireFox :
TypeError: t is undefined @ /Scripts/kendo/2013.2.716/kendo.all.min.js:31
TypeError: n.slice is not a function @ /Scripts/kendo/2013.2.716/kendo.all.min.js:11
Users list is perfeclty loaded in my page. Here is GetUsersList() code :
public ActionResult GetUsersList([DataSourceRequest] DataSourceRequest request)
{
var items = from x in db.Users
select new {x.UserId, Name = x.FirstName + " " + x.LastName, x.Color};
return Json(items.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
One thing I notice is that, when resources are loaded up, scheduler does not trigger any loading for events. I'm not yet used to scheduler helper, so it's not really easy to understand what issue is.
Thanks you for your help.
Best Regards,
Claude