@@ -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>' ) ) ;
@@ -197,6 +198,10 @@ $.extend(Datepicker.prototype, {
197
198
} ) ;
198
199
this . _autoSize ( inst ) ;
199
200
$ . 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
+ }
200
205
} ,
201
206
202
207
/* Make attachments based on settings. */
@@ -276,6 +281,10 @@ $.extend(Datepicker.prototype, {
276
281
this . _setDate ( inst , this . _getDefaultDate ( inst ) , true ) ;
277
282
this . _updateDatepicker ( inst ) ;
278
283
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
+ }
279
288
inst . dpDiv . show ( ) ;
280
289
} ,
281
290
0 commit comments