Prashant Kalkar
Prashant Kalkar

Reputation: 700

How to highlight today's date in DateTextBox in dojo

Is there any way to highlight (show selected) current date in dojo DateTextBox when the text box is empty? I do not want to show the date in the text box (it should remain empty), but just to show today's date as selected.

I tried to use the 'dropDownDefaultValue' attribute provided by dojo for this, but it is not working (current value is not shown as selected or highlighted).

I am using dojo version 1.7.1.

Any suggestions in this regards that will be great.

Upvotes: 4

Views: 790

Answers (1)

BuffaloBuffalo
BuffaloBuffalo

Reputation: 7852

If you look at the html that is used for the DateTextBox popup you'll see that the td for the current date looks like this:

<td class="dijitCalendarEnabledDate dijitCalendarCurrentDate dijitCalendarCurrentMonth dijitCalendarDateTemplate" role="gridcell" data-dojo-attach-point="dateCells" aria-selected="false" tabindex="0">
    <span class="dijitCalendarDateLabel" data-dojo-attach-point="dateLabels">30</span>
</td>

If you want to style the current date so that it appears differently you should update add a css selector like

.dijitCalendarDateTemplate.dijitCalendarCurrentDate{
    /*your styling */
    background-color: green;
}

Upvotes: 7

Related Questions