jBoive
jBoive

Reputation: 1299

dijit.form.DateTextBox - setting a class on the calendar popup?

I just create a simple date-field like so:

new dijit.form.DateTextBox({
    value:d
}, input);

I need to access the resulting calendar-popup (when the field is clicked) and add a class to that.

Background: Since Dojo insists on placing the widgets as children of the body, I can't use normal CSS as I need to have a different behavior depending on where this DateTextBox is located.

Thanks!

/J

Upvotes: 2

Views: 1106

Answers (1)

Craig Swing
Craig Swing

Reputation: 8162

You can connect to the openDropDown method and then access the dropdown widget to add a css class.

var cal = new dijit.form.DateTextBox({
  value:d
}, input);

aspect.after(cal, "openDropDown", function(deferred){
  dojo.addClass(cal.dropDown.domNode, 'myCal');
});

http://jsfiddle.net/cswing/Kjr78/

Upvotes: 2

Related Questions