views:

69

answers:

1

I once saw a datepicker where the month and year where in 1 (and the same) select box, how do I do this (with options/hardcoding) The css file also gives a clue of this possibility (select.ui-datepicker-month-year) so does anybody know the answer ?

And also, I know you can show the first/last days of the next/previous month as well, but these are standard not selectable, it is possible to make these selectable? (How?)

Thanks in advance.

+2  A: 

The jQuery UI Site has these examples for you, with complete code as well: Display month & year menus

Basically it boils down to a few options set on the date picket:

$(function() {
    $('#datepicker').datepicker({
        changeMonth: true,
        changeYear: true
    });
});
Nick Craver
Thanks, I am aware of this, but I mean in 1 and the same select box<- [Jan 2010] -> and not <- [Jan] [2010] ->
Matt
Ah I understand what you're after, but other than the jQuery UI development mockups: http://wiki.jqueryui.com/DatePickerCalendar I haven't seen this anywhere
Nick Craver
Well, Ive seen in it commercial software called BaseCamp, so they must have coded that part themselves ?
Matt
Through that website I came across 'selectOtherMonths: true' (2nd question), is that in a future build or can I already download a version that is stable and compatible with jQuery 1.3.2 ?
Matt
Yep, looks like that was developed in-house or an unfamiliar plugin....if it helps, it seems they're using the prototype library and not jQuery, so maybe a plug-in available under that.
Nick Craver
Alright, seems I have to code that part by myself then as well, thanks for your help
Matt
You can use `showOtherMonths` now in the 1.7 release: http://www.jqueryui.com/demos/datepicker/#option-showOtherMonths
Nick Craver
I know, but I meant selectOtherMonths, not showOtherMonths, like in this example: http://jquery-ui.googlecode.com/svn/trunk/demos/datepicker/other-months.html
Matt
Sorry, no this isn't in 1.7.2, the fix for `selectOtherMonths` landed in the jQuery-UI SVN on June 21st, 2009 (http://code.google.com/p/jquery-ui/source/detail?r=2824), 1.7.2 was released on June 12th, 2009 (http://blog.jqueryui.com/2009/06/jquery-ui-172/) You could grab from trunk, or wait a while and 1.8 should include it.
Nick Craver