summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Frang <gnarf@gnarf.net>2011-06-16 00:40:10 -0700
committerRichard D. Worth <rdworth@gmail.com>2011-07-19 08:10:05 -0400
commitab3b78e9eb6d6231e68d29aa3b8b7654d732eb52 (patch)
tree908efeeb8d4f3dafc005d9d5251331c9fef1a36e
parentb8e14e79e5bc630bf459137896c08fc37936f52f (diff)
downloadjquery-ui-ab3b78e9eb6d6231e68d29aa3b8b7654d732eb52.tar.gz
jquery-ui-ab3b78e9eb6d6231e68d29aa3b8b7654d732eb52.zip
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 4bdbab9a671c1eaeaea0a2c179b74cde2f84d75e)
-rw-r--r--ui/jquery.ui.datepicker.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js
index 3f3e73a70..19696236c 100644
--- a/ui/jquery.ui.datepicker.js
+++ b/ui/jquery.ui.datepicker.js
@@ -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>'));
@@ -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. */
@@ -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();
},