UI Widgets Calendar

A calendar widget.

Included in: dx.mobile.js, dx.web.js, dx.viz-web.js, dx.all.js
Module: ui/calendar
Calendar interactive configuration
Copy code
$("#calendar").dxCalendar({
});

The Calendar widget displays the date on a calendar and enables a user to select the required date.

You can create a widget using one of the following approaches.

  • jQuery
    Use the dxCalendar jQuery plug-in.

    HTML
    <div id="calendar"></div>
    JavaScript
    $("#calendar").dxCalendar({
        min: new Date(2000,1,1),
        max: new Date(2029,12,31),
        firstDayOfWeek: 0
    });
  • Knockout
    Add a div element and apply the dxCalendar binding to this element.

    HTML
    <div data-bind="dxCalendar: {
        min: new Date(2000,1,1),
        max: new Date(2029,12,31),
        firstDayOfWeek: 0
    }"></div>
  • AngularJS
    Add a div element and apply the dx-calendar directive to this element.

    HTML
    <div dx-calendar="{
        min: new Date(2000,1,1),
        max: new Date(2029,12,31),
        firstDayOfWeek: 0
    }"></div>

Note that DevExtreme widgets require you to link the jQuery library to your application. If you use the Knockout or AngularJS approach, the Knockout or AngularJS library is also required. For detailed information on linking these libraries to your project, refer to the Installation article.

You can find the detailed information on principles of working with the widget in the dxCalendar section of the Editor Widgets article.

View Demo

Watch Video

Show Example:
AngularJS
Knockout
jQuery
<div ng-controller="demoController">
    <div dx-calendar="{ 
        bindingOptions: { 
            firstDayOfWeek: 'firstDayOfWeekValue'
        }
    }"></div> 
    <div class="dx-fieldset">
        <div class="dx-field-label">
            firstDayOfWeek
        </div>
        <div class="dx-field-value">
            <div ng-model="firstDayOfWeekValue" dx-number-box="{
                min: 0,
                max: 6,
                showSpinButtons: true
            }"></div>
        </div>
    </div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.firstDayOfWeekValue = 0;
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
<div data-bind="dxCalendar: { firstDayOfWeek: firstDayOfWeekValue }"></div> 
<div class="dx-fieldset">
    <div class="dx-field-label">
        firstDayOfWeek
    </div>
    <div class="dx-field-value">
        <div data-bind="dxNumberBox: { 
            value: firstDayOfWeekValue,
            min: 0,
            max: 6,
            showSpinButtons: true
        }"></div>
    </div>
</div>
var myViewModel = {
    firstDayOfWeekValue: ko.observable(0)
}
ko.applyBindings(myViewModel);
<div id="myCalendar"></div> 
<div class="dx-fieldset">
    <div class="dx-field-label">
        firstDayOfWeek
    </div>
    <div class="dx-field-value">
        <div id="firstDaySelector"></div>
    </div>
</div>
$("#myCalendar").dxCalendar({});
$("#firstDaySelector").dxNumberBox({
    showSpinButtons: true,
    min: 0,
    max: 6,
    onValueChanged: function (e) {
        $("#myCalendar").dxCalendar("instance").option("firstDayOfWeek", e.value);
    }
});

Configuration

An object defining configuration options for the Calendar widget.

Methods

This section describes members used to manipulate the widget.

Events

This section describes events fired by this widget.

Default Cell Template

This section lists the fields that are used in a default template for calendar cells.

By default, a predefined cell template is applied to display calendar cells. This template is based on certain fields of an object holding cell information. Below is the list of these fields. If the default cell template is not appropriate for your task, implement a custom cell template based on these fields.

See Also