Calendar 2.9.0

Class YAHOO.widget.CalendarGroup

YAHOO.widget.CalendarGroup is a special container class for YAHOO.widget.Calendar. This class facilitates
the ability to have multi-page calendar views that share a single dataset and are
dependent on each other.
The calendar group instance will refer to each of its elements using a 0-based index.
For example, to construct the placeholder for a calendar group widget with id "cal1" and
containerId of "cal1Container", the markup would be as follows:

The tables for the calendars ("cal1_0" and "cal1_1") will be inserted into those containers.

NOTE: As of 2.4.0, the constructor's ID argument is optional.
The CalendarGroup can be constructed by simply providing a container ID string,
or a reference to a container DIV HTMLElement (the element needs to exist
in the document).
E.g.:

If not provided, the ID will be generated from the container DIV ID by adding an "_t" suffix.
For example if an ID is not provided, and the container's ID is "calContainer", the CalendarGroup's ID will be set to "calContainer_t".

Constructor

YAHOO.widget.CalendarGroup
(
id
,
container
,
config
)

Parameters:

id
<String>
optional The id of the table element that will represent the CalendarGroup widget. As of 2.4.0, this argument is optional.

container
<String | HTMLElement>
The id of the container div element that will wrap the CalendarGroup table, or a reference to a DIV element which exists in the document.

YAHOO.widget.CalendarGroup.DEFAULT_CONFIG
- static Object An object with key/value pairs, the key being the
uppercase configuration property name and the value being an objec
literal with a key string property, and a value property, specifying the
default value of the property

The set of default Config property keys and values for the CalendarGroup.

NOTE: This property is made public in order to allow users to change
the default values of configuration properties. Users should not
modify the key string, unless they are overriding the Calendar implementation

Methods

Sets the month on a Date object, taking into account year rollover if the month is less than 0 or greater than 11.
The Date object passed in is modified. It should be cloned before passing it into this method if the original value needs to be maintained

Adds a month renderer to the render stack. The function reference passed to this method will be executed
when a date cell matches the month passed to this method

NOTE: The contents of the cell set by the renderer will be added to the DOM as HTML. The custom renderer implementation should
escape markup used to set the cell contents, if coming from an external source.

Parameters:

month
<Number>
The month (1-12) to associate with this renderer

fnRender
<Function>
The function executed to render cells that match the render rules for this renderer.

Adds a renderer to the render stack. The function reference passed to this method will be executed
when a date cell matches the conditions specified in the date string for this renderer.

NOTE: The contents of the cell set by the renderer will be added to the DOM as HTML. The custom renderer implementation should
escape markup used to set the cell contents, if coming from an external source.

Adds a weekday renderer to the render stack. The function reference passed to this method will be executed
when a date cell matches the weekday passed to this method.

NOTE: The contents of the cell set by the renderer will be added to the DOM as HTML. The custom renderer implementation should
escape HTML used to set the cell contents, if coming from an external source.

Deselects a date or a collection of dates on the current calendar. This method, by default,
does not call the render method explicitly. Once deselection has completed, render must be
called for the changes to be reflected visually.

Parameters:

date
<String/Date/Date[]>
The date string of dates to deselect in the current calendar. Valid formats are
individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
This method can also take a JavaScript Date object or an array of Date objects.

Returns:
Date[]

Array of JavaScript Date objects representing all individual dates that are currently selected.

Array of JavaScript Date objects representing all individual dates that are currently selected.
Assuming that this function executes properly, the return value should be an empty array.
However, the empty array is returned for the sake of being able to check the selection status
of the calendar.

Deselects dates in the CalendarGroup based on the cell index provided. This method is used to select cells without having to do a full render. The selected style is applied to the cells directly.
deselectCell will deselect the cell at the specified index on each displayed Calendar page.

Parameters:

cellIndex
<Number>
The index of the cell to deselect.

Returns:
Date[]

Array of JavaScript Date objects representing all individual dates that are currently selected.

Destroys the CalendarGroup instance. The method will remove references
to HTML elements, remove any event listeners added by the CalendarGroup.
It will also destroy the Config and CalendarNavigator instances created by the
CalendarGroup and the individual Calendar instances created for each page.

Removes all custom renderers added to the CalendarGroup through the addRenderer, addMonthRenderer and
addWeekRenderer methods. CalendarGroup's render method needs to be called to after removing renderers
to see the changes applied.

Selects a date or a collection of dates on the current calendar. This method, by default,
does not call the render method explicitly. Once selection has completed, render must be
called for the changes to be reflected visually.

Parameters:

date
<String/Date/Date[]>
The date string of dates to select in the current calendar. Valid formats are
individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
This method can also take a JavaScript Date object or an array of Date objects.

Returns:
Date[]

Array of JavaScript Date objects representing all individual dates that are currently selected.

Selects dates in the CalendarGroup based on the cell index provided. This method is used to select cells without having to do a full render. The selected style is applied to the cells directly.
The value of the MULTI_SELECT Configuration attribute will determine the set of dates which get selected.

If MULTI_SELECT is false, selectCell will select the cell at the specified index for only the last displayed Calendar page.

If MULTI_SELECT is true, selectCell will select the cell at the specified index, on each displayed Calendar page.

Parameters:

cellIndex
<Number>
The index of the cell to be selected.

Returns:
Date[]

Array of JavaScript Date objects representing all individual dates that are currently selected.

Fired after the CalendarGroup is destroyed. This event should be used
for notification only. When this event is fired, important CalendarGroup instance
properties, dom references and event listeners have already been
removed/dereferenced, and hence the CalendarGroup instance is not in a usable
state.

Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
This property is enabled by default for IE6 and below. It is disabled by default for other browsers for performance reasons, but can be
enabled if required.

Configuration for the Month/Year CalendarNavigator UI which allows the user to jump directly to a
specific Month/Year without having to scroll sequentially through months.

Setting this property to null (default value) or false, will disable the CalendarNavigator UI.

Setting this property to true will enable the CalendarNavigatior UI with the default CalendarNavigator configuration values.

This property can also be set to an object literal containing configuration properties for the CalendarNavigator UI.
The configuration object expects the the following case-sensitive properties, with the "strings" property being a nested object.
Any properties which are not provided will use the default values (defined in the CalendarNavigator class).

strings

Object : An object with the properties shown below, defining the string labels to use in the Navigator's UI. The strings are inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.

month

HTML : The markup to use for the month label. Defaults to "Month".

year

HTML : The markup to use for the year label. Defaults to "Year".

submit

HTML : The markup to use for the submit button label. Defaults to "Okay".

cancel

HTML : The markup to use for the cancel button label. Defaults to "Cancel".

invalidYear

HTML : The markup to use for invalid year values. Defaults to "Year needs to be a number".

monthFormat

String : The month format to use. Either YAHOO.widget.Calendar.LONG, or YAHOO.widget.Calendar.SHORT. Defaults to YAHOO.widget.Calendar.LONG

initialFocus

String : Either "year" or "month" specifying which input control should get initial focus. Defaults to "year"

HTML : The markup to use for the "Previous Month" navigation label. Defaults to "Previous Month". The string is added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.

nextMonth

HTML : The markup to use for the "Next Month" navigation UI. Defaults to "Next Month". The string is added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.

close

HTML : The markup to use for the close button label. Defaults to "Close". The string is added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.

The positive or negative year offset from the Gregorian calendar year (assuming a January 1st rollover) to
be used when displaying or parsing dates. NOTE: All JS Date objects returned by methods, or expected as input by
methods will always represent the Gregorian year, in order to maintain date/month/week values.