Skip to content

Commit ab3b78e

Browse files
gnarfrdworth
authored andcommitted
Merge pull request #322 from kborchers/bug_5665
Datepicker: Added checks for the disabled option. Fixed #5665 - Datepicker: Disabled parameter doesn't work(cherry picked from commit 4bdbab9)
1 parent b8e14e7 commit ab3b78e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ui/jquery.ui.datepicker.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ function Datepicker() {
105105
altFormat: '', // The date format to use for the alternate field
106106
constrainInput: true, // The input is constrained by the current date format
107107
showButtonPanel: false, // True to show button panel, false to not show it
108-
autoSize: false // True to size the input for the date format, false to leave as is
108+
autoSize: false, // True to size the input for the date format, false to leave as is
109+
disabled: false // The initial disabled state
109110
};
110111
$.extend(this._defaults, this.regional['']);
111112
this.dpDiv = bindHover($('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'));
@@ -197,6 +198,10 @@ $.extend(Datepicker.prototype, {
197198
});
198199
this._autoSize(inst);
199200
$.data(target, PROP_NAME, inst);
201+
//If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
202+
if( inst.settings.disabled ) {
203+
this._disableDatepicker( target );
204+
}
200205
},
201206

202207
/* Make attachments based on settings. */
@@ -276,6 +281,10 @@ $.extend(Datepicker.prototype, {
276281
this._setDate(inst, this._getDefaultDate(inst), true);
277282
this._updateDatepicker(inst);
278283
this._updateAlternate(inst);
284+
//If disabled option is true, disable the datepicker before showing it (see ticket #5665)
285+
if( inst.settings.disabled ) {
286+
this._disableDatepicker( target );
287+
}
279288
inst.dpDiv.show();
280289
},
281290

0 commit comments

Comments
 (0)