简体   繁体   中英

Using Kendo UI - Creating the Calendar

This is a very basic question - how do I create Kendo UI controls/how do get the Kendo widgets to show?

eg. I tried this for the calendar control. I copied the js files to a js folder

  • min
  • web
  • vsdoc
  • calendar

and linked the 2 style files.

when I have the following script to instantiate a calendar widget

<script>
    $(document).ready(function () {
        $("#cal").kendoCalendar({
            value: new Date(),
            min: new Date(1950, 0, 1),
            max: new Date(2049, 11, 31)
        });
    });
</script>

But I get an error at instantiating the calendar at .kendoCalendar().

Can someone help me with this?

Thanks in advance.

You just need to include:

<!-- Kendo UI Web styles-->
<link href="styles/kendo.common.min.css" rel="stylesheet" type="text/css"/>
<link href="styles/kendo.default.min.css" rel="stylesheet" type="text/css"/>

<!-- jQuery scripts-->
<script src="js/jquery.min.js" type="text/javascript"></script>

<!-- Kendo UI Web scripts-->
<script src="js/kendo.web.min.js" type="text/javascript"></script>

kendo.web.min.js includes all the widgets. It's enough including this.

You didn't mention jquery.min.js . Check that you also have it.

This is the HTML:

<div id="cal" name="cal"/>

EDIT : Complete example using files fomr KendoUI CDN:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>OnaBai - KendoUI Calendar example</title>
    <!-- Kendo UI Web styles-->
    <link href="http://cdn.kendostatic.com/2012.3.1114/styles/kendo.common.min.css" rel="stylesheet"/>
    <link href="http://cdn.kendostatic.com/2012.3.1114/styles/kendo.default.min.css" rel="stylesheet"/>

    <!-- Kendo UI Web scripts-->
    <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
    <script src="http://cdn.kendostatic.com/2012.3.1114/js/kendo.web.min.js"></script>

    <!-- Initialize Form Elements -->
    <script type="text/javascript">
        $(document).ready(function () {
            $("#cal").kendoCalendar({
                value: new Date(),
                min  : new Date(1950, 0, 1),
                max  : new Date(2049, 11, 31)
            });
        });
    </script>

</head>
<body>
<div id="cal" name="cal"/>
</body>
</html>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM