0

I'm working on a small project with a pickadate.js plugin.

On the default year, the default selected year is the greatest of all option.
Eg: using setting the year like 1910 to 2012, the default selected is 2012 and when we click on the select box the selected year which is 2012 is located at the bottom of list.

I tweaked the display and sorted the option list and now when I click on the year selectbox, the years are displayed in descending order but the default selected value is always picking the last option which is the last in the list.

I tried to change the selected value for 2012, so that when I click on the selectbox, the first entry would be 2012 and scroll down to select other year... Not scroll up.

I'm trying this one out to meet User experience.

What I tried so far:

onRender: function() {
  $('.picker__select--year option').val('2012').change();
}

The issue here is that the seleted value is 2012 and it breaks the sorting of the years. And when I check the console it gives exceeds jquery error.

Settings:

min: new Date(1910,1,1),
max: new Date(2012,11,31),
4

1 回答 1

0

用这个:

新 Pikaday().gotoYear(2012)

基本上在首选年份的末尾添加 gotoYear() 函数。

于 2017-11-08T17:28:20.090 回答