我正在尝试自定义我对 Kendo UI kendoScheduler 小部件的使用。我正在为在调度程序中添加/编辑约会时弹出的可编辑窗口指定一个自定义模板,如下所示:
editable: {
template: $("#editor").html()
},
我正在定义这样的模板:
<script id="editor" type="text/x-kendo-template">
<h3>Edit Appointment</h3>
<p>
<label>Patient: <input name="title" /></label>
</p>
<p>
<label>Start: <input data-role="datetimepicker" name="start" /></label>
</p>
</script>
所以现在我想添加一个 Kendo UI DropDownList 并将其配置为从远程数据源填充。你如何在模板中配置这些东西?
示例代码(不起作用):
<p>
<label>Type: </label><input id="appointmentTypeDropDownList" />
</p>
# var dataSource = new kendo.data.DataSource({ transport: { read: { url: "http://demos.kendoui.com/service/products", dataType: "jsonp" } } });
# $("#appointmentTypeDropDownList").kendoDropDownList({ dataSource: dataSource, dataTextField: "ProductName", dataValueField: "ProductID" } ) ;
上面代码给出的错误是: 未捕获的错误:无效的模板:'
可能这只是一个脚本编码问题;我对在模板内放置绑定 DropDownList 的正确方法更感兴趣。
更新 - 我正在尝试做的最新简化版本可在此jsfiddle URL获得。目标只是以最直接的方式绑定下拉列表。谢谢!