开发者

How to show full list of selectable year in Jquery datetimepicker

How can I show full selectable list of years when i clicked the year dropdownlist.

There is example in below link.In example when i clicked the year dropdownlist. It show just 10 years.when i select the first year(2000), the list is changing and i can see 1990 year in list.How can I show full selectable list of ye开发者_如何学Goars? Thanks for any help.

http://jsfiddle.net/t7rkk/


I forked your fiddle and modified it with a new yearRange parameter: http://jsfiddle.net/marcosfromero/Tcnfq/

$("#datet").datepicker({
        minDate:SetDate('-100y'),
        maxDate:SetDate('+0d'),
        firstDay: 1,
        changeMonth: true,
        showButtonPanel: true,
        changeYear: true,
   -->  yearRange: 'c-100,c+00' <--
    });

From jQueryUI datepicker source code:

 yearRange: 'c-10:c+10', // Range of years to display in drop-down,
            // either relative to today's year (-nn:+nn), relative to currently displayed year
            // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)

You set minDate as ('-100y'), that's why I used c-100 (current minus 100).

You set maxDate as ('+0d'), that's why I used c+00 (current plus zero).


$("#datet").datepicker({
            minDate:SetDate('-1000y'),// simply change this value to 
            maxDate:SetDate('+0d'),// and this if you wanna go more into future dates
            firstDay: 1,
            changeMonth: true,
            showButtonPanel: true,
            changeYear: true,
        });


     });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜