From 5764469c4fa01c4f371045a903a643dcfc0091c9 Mon Sep 17 00:00:00 2001 From: Adrian Moennich Date: Tue, 29 Mar 2011 14:30:55 +0200 Subject: [PATCH] Datepicker: added an option to enforce 6 calendar rows. Fixed #7210 - Add option to enforce 6-rows-calendar in datepicker --- ui/jquery.ui.datepicker.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js index ed02335e541..87dafd4f684 100644 --- a/ui/jquery.ui.datepicker.js +++ b/ui/jquery.ui.datepicker.js @@ -104,7 +104,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 + unifyNumRows: false, // True to always use six rows; ensuring datepickers showing different months having the same height }; $.extend(this._defaults, this.regional['']); this.dpDiv = $('
'); @@ -1457,6 +1458,7 @@ $.extend(Datepicker.prototype, { var showOtherMonths = this._get(inst, 'showOtherMonths'); var selectOtherMonths = this._get(inst, 'selectOtherMonths'); var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week; + var unifyNumRows = this._get(inst, 'unifyNumRows'); var defaultDate = this._getDefaultDate(inst); var html = ''; for (var row = 0; row < numMonths[0]; row++) { @@ -1495,7 +1497,7 @@ $.extend(Datepicker.prototype, { if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth) inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; - var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate + var numRows = ((isMultiMonth || unifyNumRows) ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows calender += '';