Skip to content

Commit

Permalink
Merge pull request #322 from kborchers/bug_5665
Browse files Browse the repository at this point in the history
Datepicker: Added checks for the disabled option. Fixed #5665 - Datepicker: Disabled parameter doesn't work(cherry picked from commit 4bdbab9)
  • Loading branch information
gnarf authored and rdworth committed Jul 19, 2011
1 parent b8e14e7 commit ab3b78e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ui/jquery.ui.datepicker.js
Expand Up @@ -105,7 +105,8 @@ function Datepicker() {
altFormat: '', // The date format to use for the alternate field
constrainInput: true, // The input is constrained by the current date format
showButtonPanel: false, // True to show button panel, false to not show it
autoSize: false // True to size the input for the date format, false to leave as is
autoSize: false, // True to size the input for the date format, false to leave as is
disabled: false // The initial disabled state
};
$.extend(this._defaults, this.regional['']);
this.dpDiv = bindHover($('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'));
Expand Down Expand Up @@ -197,6 +198,10 @@ $.extend(Datepicker.prototype, {
});
this._autoSize(inst);
$.data(target, PROP_NAME, inst);
//If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
if( inst.settings.disabled ) {
this._disableDatepicker( target );
}
},

/* Make attachments based on settings. */
Expand Down Expand Up @@ -276,6 +281,10 @@ $.extend(Datepicker.prototype, {
this._setDate(inst, this._getDefaultDate(inst), true);
this._updateDatepicker(inst);
this._updateAlternate(inst);
//If disabled option is true, disable the datepicker before showing it (see ticket #5665)
if( inst.settings.disabled ) {
this._disableDatepicker( target );
}
inst.dpDiv.show();
},

Expand Down

0 comments on commit ab3b78e

Please sign in to comment.