我试图在Kendo Datepicker页脚中放置一个按钮,该按钮可用于清除输入字段,但是Datepicker将页脚中的任何文本或按钮都视为当前日期的快捷方式。有人知道如何忽略这种行为吗?
谢谢
我当前的代码:
<input id="datepicker" />
<script id="footer-template" type="text/x-kendo-template">
<button id="myButton" onclick="myFunction" >Click Me!</button>
</script>
<script>
function myFunction() {
document.getElementById("datepicker").value = '';
}
$("#datepicker").kendoDatePicker({
footer: kendo.template($("#footer-template").html())
});
</script>
我可以使用“删除链接”示例来执行此操作:
http://www.telerik.com/forums/datepicker-custom-footer-without-link
我的新代码:
<input id="datepicker" />
<script id="footer-template" type="text/x-kendo-template">
#=text#
</script>
<script>
$("#datepicker").kendoDatePicker().getKendoDatePicker().one("open", function(e) {
var t = kendo.template($("#footer-template").html());
var dp = this;
setTimeout(function(){
dp.dateView.popup.wrapper.find(".k-footer").append(t({text: "<button id=\"myButton\" onclick=\"myFunction()\" >Clear</button>"}));
});
});
function myFunction() {
$("#datepicker").data("kendoDatePicker").value(null);
}
</script>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句