2
我想在我的Kendo MVC(剃鬚刀)調度程序對象中使用自定義編輯模板。我可以在模板中生成簡單對象,但無法弄清楚如何添加Dropbox並使用控制器中的數據填充它。我已經看到了從服務提要驅動的拖放框的示例,但我需要從控制器/演示服務填充列表值。以下是我迄今爲止:如何在Kendo Scheduler自定義模板中使用Dropbox?
<div id="SchedulerDiv">
@(Html.Kendo().Scheduler<TestModel>()
.Name("TestScheduler")
.Date(new DateTime(2013, 6, 13))
.StartTime(new DateTime(2013, 6, 13, 7, 00, 00))
.Height(600)
//.AllDayEventTemplateId("UpdateTemplate")
.Editable(editable=>editable.TemplateId("UpdateTemplate"))
.Views(views =>
{
views.DayView();
views.WeekView();
views.MonthView(monthView => monthView.Selected(true));
})
.Timezone("Etc/UTC")
.Resources(resource =>
{
resource.Add(m => m.ReasonId)
.Title("Reason")
.DataTextField("Text")
.BindTo(new[] {
new { Text = "It's Broken", Value = 1, Color = "#f8a398" } ,
new { Text = "Damaged", Value = 2, Color = "#51a0ed" } ,
new { Text = "Got Tired Of It", Value = 3, Color = "#56ca85" }
});
})
.DataSource(d => d
.Read("Read", "Scheduler")
.Create("Create", "Scheduler")
.Destroy("Destroy", "Scheduler")
.Update("Update", "Scheduler")
)
)
和我的自定義腳本是:
<script id="UpdateTemplate" type="text/x-kendo-template">
<h3>Edit meeting</h3>
<p>
<label>Title: <input name="title" /></label>
</p>
<p>
<label>Start: <input data-role="datetimepicker" name="start" /></label>
</p>
<p>
<label>Start: <input data-role="datetimepicker" name="end" /></label>
</p>
<p>
<select id="myDropDown" type=... /> @*<== I would like to data drive this from json data from a controller action*@
</p>
<p>
<script>
var dataSource = new kendo.data.DataSource({ transport: { read: { url: "http://demos.kendoui.com/service/products", dataType: "jsonp" } } });
jQuery(function() { jQuery("\\#myDropDown").kendoDropDownList({ dataSource: dataSource, dataTextField: "ProductName", dataValueField: "ProductID" }); });
<\/script>
</p>
以上的作品,但我想從一個驅動行源控制器動作與服務呼叫。我該怎麼做呢?謝謝!
史蒂芬