Permalink
Browse files

Datepicker: added a condition to reinitialize datepicker if there is …

…no mainDiv on the page. Fixed #5679 - Datepicker should reinitialize if dpDiv is removed
  • Loading branch information...
1 parent c0bd1c3 commit f20486d1231fce4a559bc70f0595a071e9efc59b Roman Salnikov committed Dec 1, 2011
Showing with 7 additions and 3 deletions.
  1. +7 −3 ui/jquery.ui.datepicker.js
View
10 ui/jquery.ui.datepicker.js
@@ -1792,11 +1792,15 @@ $.fn.datepicker = function(options){
}
/* Initialise the date picker. */
- if (!$.datepicker.initialized || $($.datepicker._mainDivId).length == 0) {
- $(document).mousedown($.datepicker._checkExternalClick).
- find('body').append($.datepicker.dpDiv);
+ if (!$.datepicker.initialized) {
+ $(document).mousedown($.datepicker._checkExternalClick);
$.datepicker.initialized = true;
}
+
+ /* Append datepicker main container to body if not exist. */
+ if ($($.datepicker._mainDivId).length == 0) {
+ $(document).find('body').append($.datepicker.dpDiv);
+ }
var otherArgs = Array.prototype.slice.call(arguments, 1);
if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget'))

0 comments on commit f20486d

Please sign in to comment.