aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKato Kazuyoshi <kato.kazuyoshi@gmail.com>2011-05-05 04:07:43 +0900
committerKato Kazuyoshi <kato.kazuyoshi@gmail.com>2011-05-05 04:11:48 +0900
commitfc97ccd398b60525fd9e4c0e9aa1f51048984394 (patch)
treecf26a6f26339157c09db01c2f1f68bbc9bb51b0f
parentfd1b4f84feb92b5e0684b3fb66ccc0a57caafaab (diff)
downloadjquery-ui-fc97ccd398b60525fd9e4c0e9aa1f51048984394.tar.gz
jquery-ui-fc97ccd398b60525fd9e4c0e9aa1f51048984394.zip
Datepicker: Remove old "ui-datepicker-multi-N" before add new one. Fixed #6704 - Display overflow when multiple datepickers have different numberOfMonths.
-rw-r--r--tests/unit/datepicker/datepicker_core.js8
-rw-r--r--ui/jquery.ui.datepicker.js3
2 files changed, 9 insertions, 2 deletions
diff --git a/tests/unit/datepicker/datepicker_core.js b/tests/unit/datepicker/datepicker_core.js
index 78f78ce38..badb837ed 100644
--- a/tests/unit/datepicker/datepicker_core.js
+++ b/tests/unit/datepicker/datepicker_core.js
@@ -116,8 +116,16 @@ test('baseStructure', function() {
ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure multi [2] - second month division');
child = dp.children(':eq(2)');
ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2] - row break');
+ ok(dp.is('.ui-datepicker-multi-2'), 'Structure multi [2] - multi-2');
inp.datepicker('hide').datepicker('destroy');
+ // Multi-month 3
+ inp = init('#inp', {numberOfMonths: 3});
+ inp.focus();
+ ok(dp.is('.ui-datepicker-multi-3'), 'Structure multi [3] - multi-3');
+ ok(! dp.is('.ui-datepicker-multi-2'), 'Structure multi [3] - Trac #6704');
+ inp.datepicker('hide').datepicker('destroy');
+
// Multi-month [2, 2]
inp = init('#inp', {numberOfMonths: [2, 2]});
inp.focus();
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js
index 3437d0bda..aa9caec8c 100644
--- a/ui/jquery.ui.datepicker.js
+++ b/ui/jquery.ui.datepicker.js
@@ -685,10 +685,9 @@ $.extend(Datepicker.prototype, {
var numMonths = this._getNumberOfMonths(inst);
var cols = numMonths[1];
var width = 17;
+ inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
if (cols > 1)
inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
- else
- inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
'Class']('ui-datepicker-multi');
inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +