【发布时间】:2015-12-11 09:49:02
【问题描述】:
我正在开发剑道调度程序,我需要在调度程序的创建和编辑中添加一些额外的文本框和下拉菜单。我知道可以通过将资源添加到调度程序来添加额外的下拉列表,但是如果添加额外的文本框,我们必须添加编辑模板。但在自定义模板中,我无法为具有颜色规范的用户约会类型添加下拉列表。我添加了一个简单的下拉菜单,但没有颜色说明。到目前为止我有这个: 这是我的 .cshtml 视图代码
@model List<FW.Model.UserColor>
@using Kendo.Mvc.UI;
@using Fairwater.UI.Filters
@using FW.Common.Helper
@using Fairwater.UI.Helper
<h5>Scheduler</h5>
<div class="row">
<div class="col-md-12">
@(Html.Kendo().Scheduler<FW.Model.Appointments>()
.Name("scheduler1")
.Date(new DateTime(2015, 11, 11))
.Editable(e => e.TemplateId("editor").Create(true).Confirmation(true))
.Height(600)
.Width(1000)
.EndTime(new DateTime(2025,11,11,7,00,00))
.Views(views =>
{
// views.DayView();
// views.WeekView(weekView => weekView.Selected(true));
views.MonthView(monthviw=>monthviw.Selected(true));
})
.Timezone("Etc/UTC")
//.Resources(resource =>
// {
// resource.Add(m => m.BackgroundId)
// .Title("Background")
// .DataTextField("BackgroundName")
// .DataValueField("BackgroundId")
// .Name("Background")
// .DataColorField("Color")
// .DataSource(x => x.Read(rs => rs.Action("GetBackgroundTypes", "Schedule", new { area = "Crew" })));
// })
.DataSource(d => d
.Model(m =>
{
m.Id(f => f.AppointmentId);
m.Field(f => f.Title).DefaultValue("No title");
// m.RecurrenceId(f => f.RecurrenceID);
m.Field(f => f.Title).DefaultValue("No title");
})
.Read("CrewSchedulerRead", "Schedule")
.Create("CreateAppointment", "Schedule")
.Destroy("Appointment_Destroy", "Schedule")
.Update("Appointment_Update", "Schedule")
.Events(x => x.Error("expError"))
)
)
</div>
</div>
<script id="editor" type="text/x-kendo-template">
<div class="k-edit-label">
<label for="title">Subject</label>
</div>
<div class="k-edit-field" data-container-for="title">
<input type="text" class="k-input k-textbox" name="title" data-bind="value: title">
</div>
<div class="k-edit-label">
<label for="title">Location</label>
</div>
<div class="k-edit-field" data-container-for="Location">
<input type="text" class="k-input k-textbox" name="Location" data-bind="value: Location" style="width:100%;">
</div>
<div class="k-edit-label">
<label for="BackgroundId">Background</label>
</div>
<div data-container-for="BackgroundId" class="k-edit-field">
<select id="BackgroundId" data-bind="value:BackgroundId" data-template="" data-role="dropdownlist" data-value-field="value" data-text-field="text">
@foreach (var item in Model)
{
<option style="background-color:red" value="@item.BackgroundId">@item.BackgroundName</option>
}
</select>
</div>
<div class="k-edit-label">
<label for="recurrenceRule">Repeat</label>
</div>
<div class="k-edit-field" data-container-for="recurrenceRule">
<div data-bind="value: recurrenceRule" name="recurrenceRule" data-role="recurrenceeditor"></div>
</div>
</script>
我现在是否走在正确的道路上,但我认为我已经接近了。 这就是我到目前为止所拥有的 这就是我想要的更多,颜色 dorpdown。任何帮助或建议将不胜感激。提前致谢。如果对我的问题有任何不清楚的地方,请在 cmets 中告诉我,我很乐意解释。请帮忙。
【问题讨论】:
标签: kendo-ui kendo-asp.net-mvc kendo-scheduler