Hello,
I have scheduler that has editable events. When editing an event the template that i provide loads up another scheduler. The scheduler within the editor template needs to have it's date set to match the start date of the event i'm editing. So far i can get this working by using a custom binder to bind my date in the editor model to my scheduler.
EditorTemplate:
@(Html.Kendo().Scheduler<
TaskViewModel
>()
.Name("staffAvailability")
.Height(300)
.HtmlAttributes(new {data_bind = "bindDate:start, visible:Staff.length" })
.Timezone("Europe/London")
.Editable(false)
.AutoBind(false)
.Views(views =>
{
views.TimelineView(timeline =>
{
timeline.Footer(false);
});
})
.DataSource(dataSource => dataSource
.ServerOperation(true)
.Read(read => read.Action("ListStaffSessions", "Scheduler").Data("getStaffAttendance"))
).Events(e => e.DataBound("dataBoundAttendanceControl").DataBinding("dataBindingAttendanceControl"))
)
javascript:
kendo.data.binders.widget.bindDate = kendo.data.Binder.extend({
init: function (widget, bindings, options) {
kendo.data.Binder.fn.init.call(this, widget.element[0], bindings, options);
},
refresh: function () {
var that = this,
value = that.bindings["bindDate"].get()
var scheduler = $(that.element).data("kendoScheduler");
scheduler.date(value);
}
});
The issue i have is i don't want the scheduler to read from my data source on load, so i've specified that autoBind should be false on this scheduler however because i'm trying to bind the date this way that results in a change event being fired and my data source gets read.
Is there any way for me to provide the scheduler in my editor template a start date via the html helpers to avoid having to write a custom binder?