如何从Kendo Calendar的点击事件中检索日期?

时间:2017-02-21 00:02:20

标签: calendar click kendo-asp.net-mvc

我有一个Kendo日历,有两个事件onchange和click。 onchange事件我可以获得所选日期的值。但是我也需要在用户点击所选日期时获取日期。

Traceback (most recent call last):
  File "test8.py", line 75, in <module>
    CMD().cmdloop()
  File "/usr/lib/python2.7/cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib/python2.7/cmd.py", line 221, in onecmd
    return func(arg)
TypeError: do_triangle_area() takes exactly 3 arguments (2 given)

1 个答案:

答案 0 :(得分:0)

工作演示链接dojo sample

请在下面找到代码的工作副本。

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Untitled</title>

  <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2017.1.118/styles/kendo.common.min.css">
  <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2017.1.118/styles/kendo.rtl.min.css">
  <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2017.1.118/styles/kendo.default.min.css">
  <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2017.1.118/styles/kendo.mobile.all.min.css">

  <script src="http://code.jquery.com/jquery-1.12.3.min.js"></script>
  <script src="http://kendo.cdn.telerik.com/2017.1.118/js/angular.min.js"></script>
  <script src="http://kendo.cdn.telerik.com/2017.1.118/js/jszip.min.js"></script>
  <script src="http://kendo.cdn.telerik.com/2017.1.118/js/kendo.all.min.js"></script></head>
<body>

  <h4>Pick a date</h4>
                <div id="calendar"></div>
            </div>
            <div class="box" style="text-align: center;">
                <h4>Events log</h4>
                <div class="console"></div>
            </div>

            <script>
                function onChange() {
                   // console.log("Change :: " + kendo.toString(this.value(), 'd'));
                }

                function onNavigate() {
                   // console.log("Navigate");
                }

                $("#calendar").kendoCalendar({
                    change: onChange,
                    navigate: onNavigate
                });

               $( "#calendar" ).click(function() {             
                 var d = $("#calendar").data("kendoCalendar").value();
                 console.log(d);                 

               });


            </script>


</body>
</html>