我们正在尝试使用Kendo模板在Grid Expand Client Detail Template中提供Kendo Datepicker,以下是我们正在尝试的剪裁:
<script id="templateUserDefinedFieldsHealthPlan" type="text/x-kendo-template">
<div id="indider"> </div>
<input id="datePicker1" />
</script>
and the jquery script tp provide datepicker is mentioned below :
<script>
$(() => {
var template = kendo.template($("#templateUserDefinedFieldsHealthPlan").html());
var result = template({});
//alert(result);
$('#indider').html(result);
$('#datePicker1').kendoDatePicker();
});
</script>
但尽管有Kendo DatePicker,但仅呈现空白文本框。请建议
答案 0 :(得分:0)
问题是您也将<div id="indider"> </div>
元素也放在了模板内。您需要将其放置在模板外部,以将其替换为模板的内容。
查看摘要。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Kendo UI Snippet</title>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.2.619/styles/kendo.common.min.css"/>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.2.619/styles/kendo.rtl.min.css"/>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.2.619/styles/kendo.silver.min.css"/>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.2.619/styles/kendo.mobile.all.min.css"/>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2019.2.619/js/kendo.all.min.js"></script>
</head>
<body>
<div id="indider"></div>
<script id="templateUserDefinedFieldsHealthPlan" type="text/x-kendo-template">
<input id="datePicker1" />
</script>
<script>
$(() => {
var template = kendo.template($("#templateUserDefinedFieldsHealthPlan").html());
var result = template({});
//alert(result);
$('#indider').html(result);
$('#datePicker1').kendoDatePicker();
});
</script>
</body>
</html>