I have a number of options on the page for users to choose which resources they want to load on the scheduler. On scheduler load I make a call to load the resources that they have previously save but I'm not able to manipulate or change them once the page loads. Here is my configuration.
@(Html.Kendo().Scheduler<Avianis.Models.Scheduler.AppointmentViewModel>()
.Name("scheduler")
.Date(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day))
.AutoBind(false)
.Snap(true)
.Timezone("UTC")
.Events(e =>
{
e.Navigate("scheduler_navigate");
})
.Views(views =>
{
views.TimelineView(timeline => timeline
.Title("Day")
.MajorTick(60)
.MinorTickCount(1)
.EventHeight(77)
.ColumnWidth(150)
.EventTemplateId("more-template")
);
views.CustomView("TimelineViewFiveDays");
views.CustomView("TimelineViewSevenDays");
views.CustomView("TimelineViewThirtyDays");
views.MonthView(timeline => timeline
.EventHeight(40)
);
})
.EventTemplateId("event-template")
.Group(group => group.Resources("Aircraft").Orientation(SchedulerGroupOrientation.Vertical))
.Resources(resource => resource.Add(m => m.ResourceID)
.Name("Aircraft")
.Title("Aircraft")
.DataValueField("id")
.DataTextField("text")
.DataSource(source => source.Read("GetResources", "Calendar"))
)
.Editable(editable => editable
.Update(false)
.Create(false)
.Destroy(false)
.Move(false)
.Resize(false)
)
.DataSource(dataSource => dataSource
.SignalR()
.Transport(tr => tr
.Promise("hubStart")
.Hub("calendarHub")
.Server(s => s
.Read("LoadAircraft"))
)
.Schema(schema => schema
.Model(model =>
{
model.Id(m => m.ID);
model.Field(m => m.ID).Editable(false);
model.Field("start", typeof(DateTime)).From("Start");
model.Field("end", typeof(DateTime)).From("End");
model.Field("title", typeof(string)).From("Subject");
model.Field("description", typeof(string)).From("Description");
model.Field("isAllDay", typeof(bool)).From("IsAllDay");
model.Field("ownerId", typeof(string)).From("OwnerId");
})
)
)
)
I've trying to change resources by saving the selected resources to the database then calling the line below.
$('#scheduler').data().kendoScheduler.resources[0].dataSource.read();
And I've tried it this way as well.
var scheduler = $("#scheduler").data("kendoScheduler");
scheduler.resources[0].dataSource.data(data);
scheduler.view(scheduler.view().name);
Both ways do not refresh the UI. Any help would be appreciated.