Skip to content

Commit d162087

Browse files
author
Ca-Phun Ung
committed
Datepicker - fixes #3695 [multi-datepicker layout issue in IE]: added a better fix - needs refactoring.
1 parent 56e8aad commit d162087

1 file changed

Lines changed: 7 additions & 18 deletions

File tree

ui/ui.datepicker.js

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -595,23 +595,12 @@ $.extend(Datepicker.prototype, {
595595
.trigger('mouseover')
596596
.end();
597597
var numMonths = this._getNumberOfMonths(inst);
598-
var months = this._get(inst, 'numberOfMonths');
599-
var multi = '';
600-
if (months > 1) {
601-
if (months % 4 == 0) {
602-
multi = 'ui-datepicker-multi-4';
603-
inst.dpDiv.css('width','60em');
604-
} else if (months % 3 == 0) {
605-
multi = 'ui-datepicker-multi-3';
606-
inst.dpDiv.css('width','51em');
607-
} else if (months % 2 == 0) {
608-
multi = 'ui-datepicker-multi-2';
609-
inst.dpDiv.css('width','34em');
610-
}
611-
inst.dpDiv.addClass(multi);
598+
var cols = numMonths[1];
599+
var width = 17;
600+
if (cols > 1) {
601+
inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
612602
} else {
613-
inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4');
614-
inst.dpDiv.width('');
603+
inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
615604
}
616605
inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
617606
'Class']('ui-datepicker-multi');
@@ -1352,8 +1341,8 @@ $.extend(Datepicker.prototype, {
13521341
calender += '">';
13531342
}
13541343
calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' +
1355-
(/all|left/.test(cornerClass) ? (isRTL ? next : prev) : '') +
1356-
(/all|right/.test(cornerClass) ? (isRTL ? prev : next) : '') +
1344+
(/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
1345+
(/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
13571346
this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
13581347
selectedDate, row > 0 || col > 0, monthNames) + // draw month headers
13591348
'</div><table class="ui-datepicker-calendar"><thead>' +

0 commit comments

Comments
 (0)