user593029
user593029

Reputation: 521

highlight date on calendar popup appearing on DateTextBox

Is there any way to highlight a specific date on a calendar popup (not multilselect or ordinary dojo calendar component but calendar on DateTextBox ) displayed when a user clicks on the dijit.form.DateTextBox??

Upvotes: 2

Views: 1140

Answers (2)

brady321
brady321

Reputation: 1525

I was trying to do something similar and found the following helpful. Maybe it will help you as well.

To style specific dates on the DateTextBox popup calendar you have to use popupClass and set a custom dojo class based on dijit/Calendar.

First declare a dojo class then set the popupClass for the DateTextBox:

var MyCalendar = declare("custom/widgets/MyCalendar", Calendar, {
    getClassForDate: function(date) {
       return "myCssClass"; // applies style to all days. Use logic if needed.
    }
});

dateBox = new DateTextBox({
    id: "dateBox",
    popupClass: MyCalendar
});

Above is not full code.

But, I found a working example on jsfiddle that should help: http://jsfiddle.net/ecw5U/

Upvotes: 0

Philippe
Philippe

Reputation: 6828

Yes. Set the widget value using the standard date format described here

Example :

require(['dijit/form/DateTextBox'], function(DateTextBox) {
    var dtb = new DateTextBox({value:'2012-01-13'}, "dtb")
});

Upvotes: 2

Related Questions