mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Datepicker: Remove old "ui-datepicker-multi-N" before add new one. Fixed #6704 - Display overflow when multiple datepickers have different numberOfMonths.
(cherry picked from commit fc97ccd398
)
This commit is contained in:
parent
f9faa0ab5f
commit
870977ae6b
@ -121,6 +121,14 @@ test('baseStructure', function() {
|
|||||||
ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure multi [2] - second month division');
|
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)');
|
child = dp.children(':eq(2)');
|
||||||
ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2] - row break');
|
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');
|
inp.datepicker('hide').datepicker('destroy');
|
||||||
|
|
||||||
// Multi-month [2, 2]
|
// Multi-month [2, 2]
|
||||||
|
3
ui/jquery.ui.datepicker.js
vendored
3
ui/jquery.ui.datepicker.js
vendored
@ -683,10 +683,9 @@ $.extend(Datepicker.prototype, {
|
|||||||
var numMonths = this._getNumberOfMonths(inst);
|
var numMonths = this._getNumberOfMonths(inst);
|
||||||
var cols = numMonths[1];
|
var cols = numMonths[1];
|
||||||
var width = 17;
|
var width = 17;
|
||||||
|
inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
|
||||||
if (cols > 1)
|
if (cols > 1)
|
||||||
inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
|
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') +
|
inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
|
||||||
'Class']('ui-datepicker-multi');
|
'Class']('ui-datepicker-multi');
|
||||||
inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
|
inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
|
||||||
|
Loading…
Reference in New Issue
Block a user