Thanks, this is helpful. What does inst give me access to in the onSelect function/ I'd like to change the style of the current date when the user selects it just like I can in beforeShowDay, but I want to make it something different based on different conditions so I can't just modify the css for the selected date. Does inst give me access to the current cell or link that was clicked?
On Wed, Aug 26, 2009 at 9:39 AM, Fontzter <[email protected]> wrote: > > Hi Chris, > > Code example below should help. Here's some pointers: > > For inline use a div for the datepicker. > For a full year use the numberOfMonths option -- use an array of > columns/rows. So [3,4] will be three months high and four wide. > To have it be the full year, set the defaultDate to Jan 1 of the year > For highlighting, you were correct using the beforeShowDay. > For selected highlighting, use the onSelect > > You can view the code below in action here: http://jsbin.com/utadi/edit > > Hth, > > Dave > > > var dateList = new Array(); > dateList.push("20090704"); > dateList.push("20091031"); > dateList.push("20091225"); > > $('#datepicker').datepicker({ > numberOfMonths: [3,4], > defaultDate: new Date(2009, 1 - 1, 1), > beforeShowDay: function(dateToShow){ > return [1, ($.inArray($.datepicker.formatDate('yymmdd', > dateToShow),dateList) >= 0) ? "ui-state-error": ""]; > }, > onSelect: function(dateText, inst) { alert("Do what you need with > date using currentDay:" + inst.currentDay + ", currentMonth(zero- > based):" + inst.currentMonth.toString() + " and currentYear:" + > inst.currentYear.toString()); } > }); > > > On Aug 25, 3:57 pm, chris <[email protected]> wrote: > > I'm trying to use the datepicker in inline mode to show an entire year > > and > > 1. on page load, make certain dates different colors based on > > information from a database and > > 2. When a date is selected, dynamically change the color of the date > > based on other information selected by a user. I think the > > beforeShowDay will help me do #1 but not sure if there is a way to do > > #2. And how do I get it to display a whole year from Jan to Dec of > > say 2009? > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en -~----------~----~----~----~------~----~------~--~---
