从页脚中清除Kendo Datepicker输入字段

果酱

我试图在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] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

清除Bootstrap中的表单输入字段?

来自分类Dev

清除Angular表单提交中的输入字段?

来自分类Dev

如何清除Validator类中的输入字段?

来自分类Dev

如何清除AngularJS中的输入字段

来自分类Dev

如何清除jQuery中的特定输入字段

来自分类Dev

如何清除Angular中过滤的输入字段?

来自分类Dev

如何清除AngularJS中的输入字段

来自分类Dev

清除字段并在DalekJS中输入

来自分类Dev

清除嵌套指令中的无效输入字段

来自分类Dev

清除预先输入字段

来自分类Dev

CasperJS清除输入字段

来自分类Dev

输入字段不会清除

来自分类Dev

我可以添加加速器以在Angular Material Datepicker字段中输入日期吗?

来自分类Dev

Mat-datepicker - 如何在输入字段中显示用户保存的值 - [(ngModel)]

来自分类Dev

使用Reactjs清除输入字段?

来自分类Dev

按Enter清除输入字段

来自分类Dev

输入字段清除后消失

来自分类Dev

按Enter清除输入字段

来自分类Dev

如何清除TextInputDialog的输入字段?

来自分类Dev

提交时清除输入字段

来自分类Dev

单击按钮清除输入字段

来自分类Dev

如何清除Draft-js中的输入字段

来自分类Dev

如何清除JPanel中的所有输入字段

来自分类Dev

引导程序输入字段中的位置清除按钮

来自分类Dev

无法清除Ionic的输入文本字段中的文本

来自分类Dev

引导程序输入字段中的位置清除按钮

来自分类Dev

根据Rails中的用户确认清除输入字段

来自分类Dev

在TextField中输入DatePicker问题

来自分类Dev

预先输入字段,该字段的页脚具有动态内容