Datepicker: Only generate yearshtml once. Fixes #7176 - Datepicker shows only single year in year dropdown if numberOfMonths > 1.

(cherry picked from commit 98c53d8432)
This commit is contained in:
Scott González 2011-04-04 07:55:42 -04:00
parent 8310d185b3
commit a8fc3da628

View File

@ -1575,6 +1575,7 @@ $.extend(Datepicker.prototype, {
if (!showMonthAfterYear) if (!showMonthAfterYear)
html += monthHtml + (secondary || !(changeMonth && changeYear) ? ' ' : ''); html += monthHtml + (secondary || !(changeMonth && changeYear) ? ' ' : '');
// year selection // year selection
if ( !inst.yearshtml ) {
inst.yearshtml = ''; inst.yearshtml = '';
if (secondary || !changeYear) if (secondary || !changeYear)
html += '<span class="ui-datepicker-year">' + drawYear + '</span>'; html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
@ -1611,6 +1612,7 @@ $.extend(Datepicker.prototype, {
html += '<select class="ui-datepicker-year"><option value="' + drawYear + '" selected="selected">' + drawYear + '</option></select>'; html += '<select class="ui-datepicker-year"><option value="' + drawYear + '" selected="selected">' + drawYear + '</option></select>';
} }
} }
}
html += this._get(inst, 'yearSuffix'); html += this._get(inst, 'yearSuffix');
if (showMonthAfterYear) if (showMonthAfterYear)
html += (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '') + monthHtml; html += (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '') + monthHtml;