Thursday, December 01, 2005

DateChooser as event Calendar

I was looking for a way to use an easy calendar in a project i'm working on.
I haven't found a direct way, but we do have the DateChooser available.

The DateChooser class allows you to specify "disabledRanges".
For normal use as a date chooser, this means the user cannot select a certain date or range of dates.
But if want to use this as an event calender, you can set all dates to disabled and only enable the event dates, resulting in a very acceptable event calendar!
When the user selects an enabled date (use a listener), you can display the events for that date.

Hope this little tip helps someone...

1 Comments:

Anonymous Anonymous said...

Idea is good but this doesn't actually work. If you consider the following piece of code below, in theory, should have the date 2007/5/7 selectable out of all disabled dates as of 2000/4/20. But instead, upon compile, it locks the calendar, with no ability to select any dates, or months for that matter (buttons and days are disabled).

Any thoughts?

//Code////////////////
dc.disabledRanges = [ {rangeStart: new Date(2000, 4, 20)} ];

dc.selectableRange = new Date(2007, 5, 7);

// Create listener object.
var dcListener:Object = new Object();
dcListener.change = function(evt_obj:Object) {
var thisDate:Date = evt_obj.target.selectedDate;
trace("date selected: " + thisDate);
};

// Add listener object to date chooser.
dc.addEventListener("change", dcListener);

12:06 AM  

Post a Comment

<< Home