UI Widgets Calendar

A calendar widget.

Included in: dx.phonejs.js, dx.webappjs.js, dx.all.js

The dxCalendar 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>
  • Angular
    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 and Globalize libraries to your application. If you use the Knockout or Angular approach, the Knockout or Angular library is also required.

See Also

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 dx-number-box="{
                min: 0,
                max: 6,
                showSpinButtons: true,
                bindingOptions: { value: 'firstDayOfWeekValue' } 
            }"></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 dxCalendar widget.

Methods

This section describes the members used to manipulate the widget.

Events

This section describes events exposed by this widget.