Kendo

  • UI Framework
  • Mobile
  • Demos
  • Roadmap
  • What's New
  • Download

Skin

  • Framework
  • UI Widgets
  • Integration

    Information

    Apply special style for the birthdays.

    • Description
    • View Code
    • Configuration (7)
    • Methods (8)
    • Events (2)

    The Calendar widget allows to the end user to select a date from a graphical calendar. It supports custom templates for "month" view, configurable options for min and max date, start view and the depth of the navigation.

    Getting Started

    Creating a Calendar from existing DIV element

    <!-- HTML -->
    <div id="calendar"></div>

    Calendar initialization

      $(document).ready(function(){
         $("#calendar").kendoCalendar();
      });

    When a Calendar is initialized, it will automatically be displayed near the location of the used HTML element.

    Configuring Calendar behaviors

    Calendar provides many configuration options that can be easily set during initialization. Among the properties that can be controlled:

    • Selected date
    • Minimum/Maximum date
    • Start view
    • Define the navigation depth (last view to which end user can navigate)
    • Day template
    • Footer template

    Create Calendar with selected date and defined min and max date

     $("#calendar").kendoCalendar({
         value: new Date(),
         min: new Date(1950, 0, 1),
         max: new Date(2049, 11, 31)
     });
    <p>
      Calendar will not navigate to dates less than min and bigger than max date.
    </p>

    Define start view and navigation depth

    The first rendered view can be defined with "startView" option. Navigation depth can be controlled with "depth" option. Predefined views are:

    • "month" - shows the days from the month
    • "year" - shows the months of the year
    • "decade" - shows the years from the decade
    • "century" - shows the decades from the century

    Create Calendar, which allows to select month

     $("#calendar").kendoCalendar({
         startView: "year",
         depth: "year"
     });

    Customize day template

    Calendar allows to customize content of the rendered day in the "month" view.

    Create Calendar with custom template

     $("#calendar").kendoCalendar({
         month: {
            content: '<div class="custom"><#=data.value#></div>'
         }
     });

    This templates wraps the "value" in a div HTML element. Here is an example of the object passed to the template function:

    Structure of the data object passed to the template

     data = {
       date: date, // Date object corresponding to the current cell
       title: kendo.toString(date, "D"),
       value: date.getDate(),
       dateString: toDateString(date) //Date formatted using "MM/dd/yyyy" format
     };
    No code
    depth: String
    Specifies the navigation depth.
    footer: String
    Specifies the content of the footer. If false, the footer will not be rendered.
    format: String(default: MM/dd/yyyy)
    Specifies the format, which is used to parse value set with value() method.
    max: Date(default: Date(2099, 11, 31))
    Specifies the maximum date, which the calendar can show.
    min: Date(default: Date(1900, 0, 1))
    Specifies the minimum date, which the calendar can show.
    startView: String(default: month)
    Specifies the start view.
    value: Date(default: null)
    Specifies the selected date.
    • max (value) : Date
      Gets/Sets the max value of the calendar.

      Example

      var calendar = $("#calendar").data("kendoCalendar");
      // get the max value of the calendar.
      var max = calendar.max();
      // set the max value of the calendar.
      calendar.max(new Date(2100, 0, 1));

      Parameters

      value: Date|String
      The max date to set.
      Returns
      Date The max value of the calendar.
    • min (value) : Date
      Gets/Sets the min value of the calendar.

      Example

      var calendar = $("#calendar").data("kendoCalendar");
      // get the min value of the calendar.
      var min = calendar.min();
      // set the min value of the calendar.
      calendar.min(new Date(1900, 0, 1));

      Parameters

      value: Date|String
      The min date to set.
      Returns
      Date The min value of the calendar.
    • navigate (value, viewName)
      Navigates to view

      Example

      calendar.navigate(value, view);

      Parameters

      value: Date
      Desired date
      viewName: String
      Desired view
    • navigateDown (value)
      Navigates to the lower view

      Example

      calendar.navigateDown(value);

      Parameters

      value: Date
      Desired date
    • navigateToFuture ()
      Navigates to the future

      Example

      calendar.navigateToFuture();
    • navigateToPast ()
      Navigates to the past

      Example

      calendar.navigateToPast();
    • navigateUp ()
      Navigates to the upper view

      Example

      calendar.navigateUp();
    • value (value) : Date
      Gets/Sets the value of the calendar.

      Example

      var calendar = $("#calendar").data("kendoCalendar");
      // get the value of the calendar.
      var value = calendar.value();
      // set the value of the calendar.
      calendar.value(new Date());

      Parameters

      value: Date|String
      The date to set.
      Returns
      Date The value of the calendar.
    change
    Fires when the selected date is changed
    navigate
    Fires when navigate
    • Home
    • UI Framework
    • Mobile
    • Demos
    • Roadmap
    • What's New
    • Blogs
    • Forums
    • Documentation
    • FAQ
    • About
    • Follow us on Twitter
    • Subscribe to our RSS feed

    Kendo UI is powered by Telerik

    Copyright © 2011 Telerik Inc. All rights reserved.