private
void
_addRenderer
(
type
,
aDates
,
fnRender
)
The private method used for adding cell renderers to the local render stack.
This method is called by other methods that set the renderer type prior to the method call.
- Parameters:
-
type <String>
The type string that indicates the type of date renderer being added.
Values are YAHOO.widget.Calendar.DATE, YAHOO.widget.Calendar.MONTH_DAY, YAHOO.widget.Calendar.WEEKDAY,
YAHOO.widget.Calendar.RANGE, YAHOO.widget.Calendar.MONTH
-
aDates <Array>
An array of dates used to construct the renderer. The format varies based
on the renderer type
-
fnRender <Function>
The function executed to render cells that match the render rules for this renderer.
- Returns:
void
private
Boolean
_fieldArraysAreEqual
(
array1
,
array2
)
Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.
- Parameters:
-
array1 <Number[]>
The first date field array to compare
-
array2 <Number[]>
The first date field array to compare
- Returns:
Boolean
- The boolean that represents the equality of the two arrays
private
Number
_indexOfSelectedFieldArray
(
find
)
Gets the index of a date field array [yyyy,mm,dd] in the current list of selected dates.
- Parameters:
-
find <Number[]>
The date field array to search for
- Returns:
Number
- The index of the date field array within the collection of selected dates.
-1 will be returned if the date is not found.
private
void
_parseDate
(
sDate
)
Converts a date string to a date field array
- Parameters:
-
sDate <String>
Date string. Valid formats are mm/dd and mm/dd/yyyy.
- Returns:
void
- A date field array representing the string passed to the method
private
void
_parseDates
(
sDates
)
Converts a multi or single-date string to an array of date field arrays
- Parameters:
-
sDates <String>
Date string with one or more comma-delimited dates. Valid formats are mm/dd, mm/dd/yyyy, mm/dd/yyyy-mm/dd/yyyy
- Returns:
void
- An array of date field arrays
private
void
_parseRange
(
startDate
,
endDate
)
Converts a date range to the full list of included dates
- Parameters:
-
startDate <Number[]>
Date field array representing the first date in the range
-
endDate <Number[]>
Date field array representing the last date in the range
- Returns:
void
- An array of date field arrays
private
Date
_toDate
(
dateFieldArray
)
Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.
- Parameters:
-
dateFieldArray <Number[]>
The date field array to convert to a JavaScript Date.
- Returns:
Date
- JavaScript Date object representing the date field array
private
Array[](Number[])
_toFieldArray
(
date
)
Converts a date (either a JavaScript Date object, or a date string) to the internal data structure
used to represent dates: [[yyyy,mm,dd],[yyyy,mm,dd]].
- 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:
Array[](Number[])
- Array of date field arrays
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
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
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
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
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
void
applyListeners
(
)
Applies the Calendar's DOM listeners to applicable elements.
String
buildDayLabel
(
workingDate
)
Builds the date digit that will be displayed in calendar cells
- Parameters:
-
workingDate <Date>
The current working date
- Returns:
String
- The formatted day label
String
buildMonthLabel
(
)
Builds the date label that will be displayed in the calendar header or
footer, depending on configuration.
- Returns:
String
- The formatted calendar month label
Array
buildWeekdays
(
html
)
Renders the Calendar's weekday headers.
- Parameters:
-
html <Array>
The current working HTML array
- Returns:
Array
- The current working HTML array
void
clear
(
)
Clears the selected dates in the current calendar widget and sets the calendar
to the current month and year.
void
clearAllBodyCellStyles
(
The
)
Removes all styles from all body cells in the current calendar table.
- Parameters:
-
The <style>
CSS class name to remove from all calendar body cells
- Returns:
void
void
clearElement
(
The
)
Clears the inner HTML, CSS class and style information from the specified cell.
- Parameters:
-
The <HTMLTableCellElement>
cell to clear
- Returns:
void
void
configClose
(
)
Default handler for the "close" property
void
configIframe
(
)
Renders the built-in IFRAME shim for the IE6 and below
void
configLocale
(
)
The default handler for all configuration locale properties
void
configLocaleValues
(
)
The default handler for all configuration locale field length properties
void
configMaxDate
(
)
The default handler for the "maxdate" property
void
configMinDate
(
)
The default handler for the "mindate" property
void
configOptions
(
)
The default handler for all configuration options properties
void
configPageDate
(
)
The default handler for the "pagedate" property
void
configSelected
(
)
The default handler for the "selected" property
void
configTitle
(
)
Default handler for the "title" property
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.
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.
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.
void
doCellMouseOut
(
e
,
cal
)
The event that is executed when the user moves the mouse out of a cell
- Parameters:
-
e <DOMEvent>
The event
-
cal <Calendar>
A reference to the calendar passed by the Event utility
- Returns:
void
void
doCellMouseOver
(
e
,
cal
)
The event that is executed when the user hovers over a cell
- Parameters:
-
e <DOMEvent>
The event
-
cal <Calendar>
A reference to the calendar passed by the Event utility
- Returns:
void
void
doSelectCell
(
e
,
cal
)
The default event function that is attached to a date link within a calendar cell
when the calendar is rendered.
- Parameters:
-
e <DOMEvent>
The event
-
cal <Calendar>
A reference to the calendar passed by the Event utility
- Returns:
void
Date
getDateByCellId
(
id
)
Retrieves the Date object for the specified Calendar cell
- Parameters:
-
id <String>
The id of the cell
- Returns:
Date
- The Date object for the specified Calendar cell
Array
getDateFieldsByCellId
(
id
)
Retrieves the Date object for the specified Calendar cell
- Parameters:
-
id <String>
The id of the cell
- Returns:
Array
- The array of Date fields for the specified Calendar cell
Date[]
getSelectedDates
(
)
Gets the list of currently selected dates from the calendar.
- Returns:
Date[]
- An array of currently selected JavaScript Date objects.
void
hide
(
)
Hides the Calendar's outer container from view.
void
init
(
id
,
containerId
,
config
)
Initializes the Calendar widget.
- 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
void
initEvents
(
)
Initializes Calendar's built-in CustomEvents
void
initStyles
(
)
Defines the style constants for the Calendar