YUI recommends YUI 3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

Yahoo! UI Library

Calendar  2.2.0

Yahoo! UI Library > calendar > YAHOO.widget.CalendarGroup

Class YAHOO.widget.CalendarGroup

Known Subclasses:
YAHOO.widget.Calendar2up
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: <div id="cal1Container_0"></div> <div id="cal1Container_1"></div> The tables for the calendars ("cal1_0" and "cal1_1") will be inserted into those containers.

Constructor

YAHOO.widget.CalendarGroup ( id , containerId , config )
Parameters:
id <String> The id of the table element that will represent the calendar widget
containerId <String> The id of the container div element that will wrap the calendar table
config <Object> The configuration object containing the Calendar's arguments

Properties

cfg - YAHOO.util.Config

The Config object used to hold the configuration variables for the CalendarGroup

containerId - String

The unique id associated with the CalendarGroup container

id - String

The unique id associated with the CalendarGroup

Locale - Object

The local object which contains the CalendarGroup's locale settings

oDomContainer - HTMLElement

The outer containing element for the CalendarGroup

Options - Object

The local object which contains the CalendarGroup's options

pages - YAHOO.widget.Calendar[]

The collection of Calendar pages contained within the CalendarGroup

YAHOO.widget.CalendarGroup.CSS_2UPCLOSE - static final String

CSS class representing the close icon for the 2-up calendar
Deprecated: Along with Calendar.IMG_ROOT and NAV_ARROW_LEFT, NAV_ARROW_RIGHT configuration properties. Calendar's Style.CSS_CLOSE property now represents the CSS class used to render the close icon

YAHOO.widget.CalendarGroup.CSS_2UPTITLE - static final String

CSS class representing the title for the 2-up calendar

YAHOO.widget.CalendarGroup.CSS_CONTAINER - static final String

CSS class representing the container for the calendar

YAHOO.widget.CalendarGroup.CSS_MULTI_UP - static final String

CSS class representing the container for the calendar

Methods

_setMonthOnDate

private void _setMonthOnDate ( date , iMonth )
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
Parameters:
date <Date> The Date object on which to set the month index
iMonth <Number> The month index to set
Returns: void

addMonthRenderer

void addMonthRenderer ( month , fnRender )
Adds a month 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.
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.
Returns: void

addMonths

void addMonths ( count )
Adds the designated number of months to the current calendar month, and sets the current calendar page date to the new month.
Parameters:
count <Number> The number of months to add to the current calendar
Returns: void

addRenderer

void addRenderer ( sDates , fnRender )
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.
Parameters:
sDates <String> A date string to associate with the specified renderer. Valid formats include date (12/24/2005), month/day (12/24), and range (12/1/2004-1/1/2005)
fnRender <Function> The function executed to render cells that match the render rules for this renderer.
Returns: void

addWeekdayRenderer

void addWeekdayRenderer ( weekday , fnRender )
Adds a weekday 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.
Parameters:
weekday <Number> The weekday (0-6) to associate with this renderer
fnRender <Function> The function executed to render cells that match the render rules for this renderer.
Returns: void

addYears

void addYears ( count )
Adds the designated number of years to the current calendar, and sets the current calendar page date to the new month.
Parameters:
count <Number> The number of years to add to the current calendar
Returns: void

callChildFunction

void callChildFunction ( fnName , args )
Calls a function within all child Calendars within this CalendarGroup.
Parameters:
fnName <String> The name of the function
args <Array> The arguments to pass to the function
Returns: void

clear

void clear ( )
Clears the selected dates in the current calendar widget and sets the calendar to the current month and year.
Returns: void

configPageDate

void configPageDate ( type , args , obj )
The default Config handler for the "pagedate" property
Parameters:
type <String> The CustomEvent type (usually the property name)
args <Object[]> The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
obj <Object> The scope object. For configuration handlers, this will usually equal the owner.
Returns: void

configPages

void configPages ( type , args , obj )
The default Config handler for the "pages" property
Parameters:
type <String> The CustomEvent type (usually the property name)
args <Object[]> The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
obj <Object> The scope object. For configuration handlers, this will usually equal the owner.
Returns: void

constructChild

YAHOO.widget.Calendar constructChild ( id , containerId , config )
Constructs a child calendar. This method can be overridden if a subclassed version of the default calendar is to be used.
Parameters:
id <String> The id of the table element that will represent the calendar widget
containerId <String> The id of the container div element that will wrap the calendar table
config <Object> The configuration object containing the Calendar's arguments
Returns: YAHOO.widget.Calendar
The YAHOO.widget.Calendar instance that is constructed

delegateConfig

void delegateConfig ( type , args , obj )
Delegates a configuration property to the CustomEvents associated with the CalendarGroup's children
Parameters:
type <String> The CustomEvent type (usually the property name)
args <Object[]> The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
obj <Object> The scope object. For configuration handlers, this will usually equal the owner.
Returns: void

deselect

Date[] deselect ( date )
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.

deselectAll

Date[] deselectAll ( )
Deselects all dates on the current calendar.
Returns: Date[]
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.

deselectCell

Date[] deselectCell ( cellIndex )
Deselects a date on the current calendar by referencing the index of the cell that should be deselected. This method is used to easily deselect a single cell (usually with a mouse click) without having to do a full render. The selected style is removed from the cell directly.
Parameters:
cellIndex <Number> The index of the cell to deselect in the current calendar.
Returns: Date[]
Array of JavaScript Date objects representing all individual dates that are currently selected.

getSelectedDates

void getSelectedDates ( )
Gets the list of currently selected dates from the calendar.
Returns: void
An array of currently selected JavaScript Date objects.

init

void init ( id , containerId , config )
Initializes the calendar group. All subclasses must call this method in order for the group to be initialized properly.
Parameters:
id <String> The id of the table element that will represent the calendar widget
containerId <String> The id of the container div element that will wrap the calendar table
config <Object> The configuration object containing the Calendar's arguments
Returns: void

initEvents

void initEvents ( )
Initializes CalendarGroup's built-in CustomEvents
Returns: void

nextMonth

void nextMonth ( )
Navigates to the next month page in the calendar widget.
Returns: void

nextYear

void nextYear ( )
Navigates to the next year in the currently selected month in the calendar widget.
Returns: void

previousMonth

void previousMonth ( )
Navigates to the previous month page in the calendar widget.
Returns: void

previousYear

void previousYear ( )
Navigates to the previous year in the currently selected month in the calendar widget.
Returns: void

render

void render ( )
Calls the render function of all child calendars within the group.
Returns: void

renderFooter

void renderFooter ( )
Renders a footer for the 2-up calendar container. By default, this method is unimplemented.
Returns: void

renderHeader

void renderHeader ( )
Renders the header for the CalendarGroup.
Returns: void

reset

void reset ( )
Resets the calendar widget to the originally selected month and year, and sets the calendar to the initial selection(s).
Returns: void

select

Date[] select ( date )
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.

selectCell

Date[] selectCell ( cellIndex )
Selects a date on the current calendar by referencing the index of the cell that should be selected. This method is used to easily select a single cell (usually with a mouse click) without having to do a full render. The selected style is applied to the cell directly.
Parameters:
cellIndex <Number> The index of the cell to select in the current calendar.
Returns: Date[]
Array of JavaScript Date objects representing all individual dates that are currently selected.

setChildFunction

void setChildFunction ( fnName , fn )
Adds a function to all child Calendars within this CalendarGroup.
Parameters:
fnName <String> The name of the function
fn <Function> The function to apply to each Calendar page object
Returns: void

setMonth

void setMonth ( month )
Sets the calendar group's month explicitly. This month will be set into the first page of the multi-page calendar, and all other months will be iterated appropriately.
Parameters:
month <Number> The numeric month, from 0 (January) to 11 (December)
Returns: void

setYear

void setYear ( year )
Sets the calendar group's year explicitly. This year will be set into the first page of the multi-page calendar, and all other months will be iterated appropriately.
Parameters:
year <Number> The numeric 4-digit year
Returns: void

sub

private void sub ( fn , obj , bOverride )
Proxy subscriber to subscribe to the CalendarGroup's child Calendars' CustomEvents
Parameters:
fn <Function> The function to subscribe to this CustomEvent
obj <Object> The CustomEvent's scope object
bOverride <Boolean> Whether or not to apply scope correction
Returns: void

subtractMonths

void subtractMonths ( count )
Subtracts the designated number of months from the current calendar month, and sets the current calendar page date to the new month.
Parameters:
count <Number> The number of months to subtract from the current calendar
Returns: void

subtractYears

void subtractYears ( count )
Subtcats the designated number of years from the current calendar, and sets the current calendar page date to the new month.
Parameters:
count <Number> The number of years to subtract from the current calendar
Returns: void

toString

String toString ( )
Returns a string representation of the object.
Returns: String
A string representation of the CalendarGroup object.

unsub

private void unsub ( fn , obj )
Proxy unsubscriber to unsubscribe from the CalendarGroup's child Calendars' CustomEvents
Parameters:
fn <Function> The function to subscribe to this CustomEvent
obj <Object> The CustomEvent's scope object
Returns: void

Events

beforeDeselectEvent

beforeDeselectEvent ( )
Fired before a selection is made

beforeRenderEvent

beforeRenderEvent ( )
Fired before the Calendar is rendered

beforeSelectEvent

beforeSelectEvent ( )
Fired before a selection is made

changePageEvent

changePageEvent ( )
Fired when the Calendar page is changed

clearEvent

clearEvent ( )
Fired when the Calendar is cleared

deselectEvent

deselectEvent ( Array )
Fired when a selection is made
Parameters:
Array <Array> of Date field arrays in the format [YYYY, MM, DD].

renderEvent

renderEvent ( )
Fired when the Calendar is rendered

resetEvent

resetEvent ( )
Fired when the Calendar is reset

selectEvent

selectEvent ( Array )
Fired when a selection is made
Parameters:
Array <Array> of Date field arrays in the format [YYYY, MM, DD].

Configuration Attributes

close - Boolean

Whether or not a close button should be displayed for this CalendarGroup
Default Value: false

DATE_DELIMITER - String

The value used to delimit individual dates in a date string passed to various Calendar functions.
Default Value: ","

DATE_FIELD_DELIMITER - String

The value used to delimit date fields in a date string passed to various Calendar functions.
Default Value: "/"

DATE_RANGE_DELIMITER - String

The value used to delimit date ranges in a date string passed to various Calendar functions.
Default Value: "-"

HIDE_BLANK_WEEKS - Boolean

True if the Calendar should suppress weeks that are not a part of the current month. False by default.
Default Value: false

iframe - Boolean

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.
Default Value: true

LOCALE_MONTHS - String

The setting that determines which length of month labels should be used. Possible values are "short" and "long".
Default Value: "long"

LOCALE_WEEKDAYS - String

The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
Default Value: "short"

maxdate - String

The maximum selectable date in the current Calendar (mm/dd/yyyy)
Default Value: null

MD_DAY_POSITION - Number

The position of the day in a month/year date string
Default Value: 2

MD_MONTH_POSITION - Number

The position of the month in a month/day date string
Default Value: 1

MDY_DAY_POSITION - Number

The position of the day in a month/day/year date string
Default Value: 2

MDY_MONTH_POSITION - Number

The position of the month in a month/day/year date string
Default Value: 1

MDY_YEAR_POSITION - Number

The position of the year in a month/day/year date string
Default Value: 3

mindate - String

The minimum selectable date in the current Calendar (mm/dd/yyyy)
Default Value: null

MONTHS_LONG - String[]

The long month labels for the current locale.
Default Value: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"

MONTHS_SHORT - String[]

The short month labels for the current locale.
Default Value: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]

MULTI_SELECT - Boolean

True if the Calendar should allow multiple selections. False by default.
Default Value: false

MY_MONTH_POSITION - Number

The position of the month in a month/year date string
Default Value: 1

MY_YEAR_POSITION - Number

The position of the year in a month/year date string
Default Value: 2

NAV_ARROW_LEFT - String

The image that should be used for the left navigation arrow.
DeprecatedYou can customize the image by overriding the default CSS class for the left arrow - "calnavleft"
Default Value: null

NAV_ARROW_RIGHT - String

The image that should be used for the right navigation arrow.
DeprecatedYou can customize the image by overriding the default CSS class for the right arrow - "calnavright"
Default Value: null

pagedate - String

The month/year representing the current visible Calendar date (mm/yyyy)
Default Value: today's date

pages - Number

The number of pages to include in the CalendarGroup. This value can only be set once, in the CalendarGroup's constructor arguments.
Default Value: 2

selected - String

The date or range of dates representing the current Calendar selection
Default Value: []

SHOW_WEEK_FOOTER - Boolean

True if the Calendar should show week row footers. False by default.
Default Value: false

SHOW_WEEK_HEADER - Boolean

True if the Calendar should show week row headers. False by default.
Default Value: false

SHOW_WEEKDAYS - Boolean

True if the Calendar should show weekday labels. True by default.
Default Value: true

START_WEEKDAY - number

The weekday the week begins on. Default is 0 (Sunday).
Default Value: 0

title - String

The title to display above the CalendarGroup's month header
Default Value: ""

WEEKDAYS_1CHAR - String[]

The 1-character weekday labels for the current locale.
Default Value: ["S", "M", "T", "W", "T", "F", "S"]

WEEKDAYS_LONG - String[]

The long weekday labels for the current locale.
Default Value: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]

WEEKDAYS_MEDIUM - String[]

The medium weekday labels for the current locale.
Default Value: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]

WEEKDAYS_SHORT - String[]

The short weekday labels for the current locale.
Default Value: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]


Copyright © 2007 Yahoo! Inc. All rights reserved.