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

This commit is contained in:
Scott González 2011-04-04 07:55:42 -04:00
parent 255a8dbba5
commit 98c53d8432

View File

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