@@ -105,7 +105,8 @@ function Datepicker() {
105
105
altFormat : '' , // The date format to use for the alternate field
106
106
constrainInput : true , // The input is constrained by the current date format
107
107
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
109
110
} ;
110
111
$ . extend ( this . _defaults , this . regional [ '' ] ) ;
111
112
this . dpDiv = bindHover ( $ ( '<div id="' + this . _mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>' ) ) ;
@@ -194,6 +195,10 @@ $.extend(Datepicker.prototype, {
194
195
} ) ;
195
196
this . _autoSize ( inst ) ;
196
197
$ . data ( target , PROP_NAME , inst ) ;
198
+ //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
199
+ if ( inst . settings . disabled ) {
200
+ this . _disableDatepicker ( target ) ;
201
+ }
197
202
} ,
198
203
199
204
/* Make attachments based on settings. */
@@ -273,6 +278,10 @@ $.extend(Datepicker.prototype, {
273
278
this . _setDate ( inst , this . _getDefaultDate ( inst ) , true ) ;
274
279
this . _updateDatepicker ( inst ) ;
275
280
this . _updateAlternate ( inst ) ;
281
+ //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
282
+ if ( inst . settings . disabled ) {
283
+ this . _disableDatepicker ( target ) ;
284
+ }
276
285
inst . dpDiv . show ( ) ;
277
286
} ,
278
287
0 commit comments