Grid init:
<
div
class
=
"AbsenceGrid"
>
@(Html.Kendo().Scheduler<
AbsenceViewModel
>()
.Name("employeeScheduler")
.Date(DateTime.Now)
.Height(600)
.Views(views => views.MonthView())
.Editable(e => e.TemplateName("AbsenceEditor"))
.Resources(res =>
{
res.Add(r => r.AuthorisedById)
.Title("Authorised By")
.DataTextField("Name")
.DataValueField("EmployeeId")
.DataSource(d =>d.Read(r => r.Action("AuthorisedByRead", "Schedule")));
})
.DataSource(d => d
.Model(m => m.Id(f => f.EmployeeAbsenceId))
.Read(r => r.Action("EmployeesAbsencesRead", "Schedule"))
.Create(c => c.Action("EmployeesAbsencesCreate", "Schedule"))
.Destroy("Destroy", "Schedule")
.Update("Update", "Schedule")
)
)
</
div
>
Custom Template: (Views/Shared/EditorTemplates/AbsenceEditor.cshtml)
@model Employees.Web.Models.AbsenceViewModel
@Html.HiddenFor(x => x.EmployeeAbsenceId)
<
div
class
=
"editor-label"
>
@Html.LabelFor(x => x.Title)
</
div
>
<
div
class
=
"editor-field"
>
@Html.EditorFor(x => x.Title)
</
div
>
<
br
/>
<
div
class
=
"editor-label"
>
@Html.LabelFor(x => x.Start)
</
div
>
<
div
class
=
"editor-field"
>
@Html.EditorFor(x => x.Start)
</
div
>
<
br
/>
<
div
class
=
"editor-label"
>
@Html.LabelFor(x => x.End)
</
div
>
<
div
class
=
"editor-field"
>
@Html.EditorFor(x => x.End)
</
div
>
<
br
/>
<
div
class
=
"editor-label"
>
@Html.LabelFor(x => x.IsAllDay)
</
div
>
<
div
class
=
"editor-field"
>
@Html.EditorFor(x => x.IsAllDay)
</
div
>
<
br
/>
<
div
class
=
"editor-label"
>
@Html.LabelFor(x => x.Description)
</
div
>
<
div
class
=
"editor-field"
>
@Html.EditorFor(x => x.Description)
</
div
>
<
br
/>
Firstly, is it possible to do it using razor as above, or do I have to use the MVVM binding method? Currently the view shows, but none of the values from the model are persisted into the form and the form won't submit, but I guess I'll get to that in time.
Secondly, if that's possible, how would I include the recurrence rule editor?
Thanks.