Class YAHOO.widget.Calendar_Core
Calendar_Core is the base class for the Calendar widget. In its most basic implementation, it has the ability to render a calendar widget on the page that can be manipulated to select a single date, move back and forth between months and years.
To construct the placeholder for the calendar widget, the code is as follows:
Defined in: calendar.js.
Constructor Attributes | Constructor Name and Description |
---|---|
YAHOO.widget.Calendar_Core(id, containerId, monthyear, selected)
|
Field Attributes | Field Name and Description |
---|---|
<private> |
A Date object representing the month/year that the calendar is initially set to
|
<private> |
A copy of the initial render functions created before rendering.
|
<private> |
The private list of initially selected dates.
|
The collection of calendar cell dates that is parallel to the cells collection.
|
|
The collection of calendar table cells
|
|
Container for the CSS style configuration variables.
|
|
<static> |
YAHOO.widget.Calendar_Core.DATE
Type constant used for renderers to represent an individual date (M/D/Y)
|
<static> |
YAHOO.widget.Calendar_Core.DISPLAY_DAYS
Constant that represents the total number of date cells that are displayed in a given month
including
|
The HTML cell element that represents the main header cell TH used in the calendar table
|
|
The id that uniquely identifies this calendar.
|
|
<static> |
YAHOO.widget.Calendar_Core.IMG_ROOT
The path to be used for images loaded for the Calendar
|
The index of this item in the parent group
|
|
A Date object representing the maximum selectable date
|
|
A Date object representing the minimum selectable date
|
|
<static> |
YAHOO.widget.Calendar_Core.MONTH
Type constant used for renderers to represent a month across any year
|
<static> |
YAHOO.widget.Calendar_Core.MONTH_DAY
Type constant used for renderers to represent an individual date across any year (M/D)
|
The DOM element reference that points to this calendar's container element.
|
|
A Date object representing the month/year that the calendar is currently set to
|
|
The parent CalendarGroup, only to be set explicitly by the parent group
|
|
<static> |
YAHOO.widget.Calendar_Core.RANGE
Type constant used for renderers to represent a range of individual dates (M/D/Y-M/D/Y)
|
The list of render functions, along with required parameters, used to render cells.
|
|
The list of currently selected dates.
|
|
A boolean indicating whether the shell of the calendar has already been rendered to the page
|
|
<static> |
YAHOO.widget.Calendar_Core.STOP_RENDER
Constant used for halting the execution of the remainder of the render stack
|
The HTML table element that represents this calendar
|
|
A Date object representing today's date.
|
|
<static> |
YAHOO.widget.Calendar_Core.WEEKDAY
Type constant used for renderers to represent a weekday
|
The collection of calendar week footer cells
|
|
The collection of calendar week header cells
|
Method Attributes | Method Name and Description |
---|---|
<private> |
_addRenderer(type, aDates, fnRender)
The private method used for adding cell renderers to the local render stack.
|
<private> |
_fieldArraysAreEqual(array1, array2)
Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.
|
<private> <static> |
YAHOO.widget.Calendar_Core._getBrowser()
Returns a string representing the current browser.
|
<private> |
Gets the index of a date field array [yyyy,mm,dd] in the current list of selected dates.
|
<private> |
_parseDate(sDate)
Converts a date string to a date field array
|
<private> |
_parseDates(sDates)
Converts a multi or single-date string to an array of date field arrays
|
<private> |
_parseRange(startDate, endDate)
Converts a date range to the full list of included dates
|
<private> |
_toDate(dateFieldArray)
Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.
|
<private> |
_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]].
|
<private> |
_unload(e, cal)
|
addMonthRenderer(month, fnRender)
Adds a month to the render stack.
|
|
addMonths(count)
Adds the designated number of months to the current calendar month, and sets the current
calendar page date to the new month.
|
|
addRenderer(sDates, fnRender)
Adds a renderer to the render stack.
|
|
addWeekdayRenderer(weekay, fnRender)
Adds a weekday to the render stack.
|
|
addYears(count)
Adds the designated number of years to the current calendar, and sets the current
calendar page date to the new month.
|
|
buildDayLabel(workingDate)
Builds the date digit that will be displayed in calendar cells
|
|
Builds the date label that will be displayed in the calendar header or
footer, depending on configuration.
|
|
Builds the calendar table shell that will be filled in with dates and formatting.
|
|
Builds the calendar shell body (6 weeks by 7 days)
|
|
Builds the calendar shell footer.
|
|
Builds the calendar shell header by inserting a THEAD into the local calendar table.
|
|
clear()
Clears the selected dates in the current calendar widget and sets the calendar
to the current month and year.
|
|
Removes all styles from all body cells in the current calendar table.
|
|
clearElement(The)
Clears the inner HTML, CSS class and style information from the specified cell.
|
|
This method is called when subclasses need to override configuration variables
or create new ones.
|
|
deselect(date)
Deselects a date or a collection of dates on the current calendar.
|
|
Deselects all dates on the current calendar.
|
|
deselectCell(cellIndex)
Deselects a date on the current calendar by referencing the index of the cell that should be deselected.
|
|
<private> |
doCellMouseOut(e, cal)
The event that is executed when the user moves the mouse out of a cell
|
<private> |
doCellMouseOver(e, cal)
The event that is executed when the user hovers over a cell
|
<private> |
doNextMonth(e, cal)
A wrapper event that executes the nextMonth method through a DOM event
|
<private> |
doPreviousMonth(e, cal)
A wrapper event that executes the previousMonth method through a DOM event
|
doSelectCell(e, cal)
The default event function that is attached to a date link within a calendar cell
when the calendar is rendered.
|
|
Gets the list of currently selected dates from the calendar.
|
|
init(id, containerId, monthyear, selected)
Initializes the calendar widget.
|
|
isDateOOM(date)
Determines whether a given date is OOM (out of month).
|
|
Navigates to the next month page in the calendar widget.
|
|
nextYear()
Navigates to the next year in the currently selected month in the calendar widget.
|
|
Event executed before a date is deselected in the calendar widget.
|
|
Event executed before a date is selected in the calendar widget.
|
|
Event executed when the user navigates to a different calendar page.
|
|
onClear()
Event executed when the calendar widget is completely cleared to the current month with no selections.
|
|
Event executed when a date is deselected in the calendar widget.
|
|
onRender()
Event executed when the calendar widget is rendered.
|
|
onReset()
Event executed when the calendar widget is reset to its original state.
|
|
onSelect()
Event executed when a date is selected in the calendar widget.
|
|
Navigates to the previous month page in the calendar widget.
|
|
Navigates to the previous year in the currently selected month in the calendar widget.
|
|
render()
Renders the calendar after it has been configured.
|
|
renderBody(workingDate)
Appends the calendar body.
|
|
renderBodyCellRestricted(workingDate, cell)
Renders the current calendar cell as a non-selectable "black-out" date using the default
restricted style.
|
|
renderCellDefault(workingDate, cell)
Renders a single standard calendar cell in the calendar widget table.
|
|
renderCellNotThisMonth(workingDate, cell)
Applies the default style used for rendering dates that are not a part of the current
month (preceding or trailing the cells for the current month)
|
|
renderCellStyleHighlight1(workingDate, cell)
Renders a single standard calendar cell using the CSS hightlight1 style
|
|
renderCellStyleHighlight2(workingDate, cell)
Renders a single standard calendar cell using the CSS hightlight2 style
|
|
renderCellStyleHighlight3(workingDate, cell)
Renders a single standard calendar cell using the CSS hightlight3 style
|
|
renderCellStyleHighlight4(workingDate, cell)
Renders a single standard calendar cell using the CSS hightlight4 style
|
|
renderCellStyleSelected(workingDate, cell)
Applies the default style used for rendering selected dates to the current calendar cell
|
|
renderCellStyleToday(workingDate, cell)
Applies the default style used for rendering today's date to the current calendar cell
|
|
Appends the contents of the calendar widget footer into the shell.
|
|
Appends the header contents into the widget header.
|
|
renderOutOfBoundsDate(workingDate, cell)
*************** BEGIN BUILT-IN TABLE CELL RENDERERS ***********************************
|
|
renderRowFooter(workingDate, cell)
Renders the row footer for a week.
|
|
renderRowHeader(workingDate, cell)
Renders the row header for a week.
|
|
Outputs the calendar shell to the DOM, inserting it into the placeholder element.
|
|
reset()
Resets the calendar widget to the originally selected month and year, and
sets the calendar to the initial selection(s).
|
|
Resets the render stack of the current calendar to its original pre-render value.
|
|
select(date)
Selects a date or a collection of dates on the current calendar.
|
|
selectCell(cellIndex)
Selects a date on the current calendar by referencing the index of the cell that should be selected.
|
|
<static> |
YAHOO.widget.Calendar_Core.setCssClasses(element, aStyles)
Sets the specified array of CSS classes into the referenced element
|
setMonth(month)
Sets the calendar's month explicitly.
|
|
This method is called to initialize the widget configuration variables, including
style, localization, and other display and behavioral options.
|
|
setYear(year)
Sets the calendar's year explicitly.
|
|
subtractMonths(count)
Subtracts the designated number of months from the current calendar month, and sets the current
calendar page date to the new month.
|
|
subtractYears(count)
Subtcats the designated number of years from the current calendar, and sets the current
calendar page date to the new month.
|
|
toString()
Returns a string representation of the object.
|
|
validate()
Validates the calendar widget.
|
|
This function can be extended by subclasses to attach additional DOM events to
the calendar.
|
|
Wires the local DOM events for the Calendar, including cell selection, hover, and
default navigation that is used for moving back and forth between calendar pages.
|
Class Detail
YAHOO.widget.Calendar_Core(id, containerId, monthyear, selected)
- Parameters:
- {String} id
- The id of the table element that will represent the calendar widget
- {String} containerId
- The id of the container element that will contain the calendar table
- {String} monthyear
- The month/year string used to set the current calendar page
- {String} selected
- A string of date values formatted using the date parser. The built-in default date format is MM/DD/YYYY. Ranges are defined using MM/DD/YYYY-MM/DD/YYYY. Month/day combinations are defined using MM/DD. Any combination of these can be combined by delimiting the string with commas. Example: "12/24/2005,12/25,1/18/2006-1/21/2006"
Field Detail
<private>
{Date}
_pageDate
A Date object representing the month/year that the calendar is initially set to
<private>
{Array}
_renderStack
A copy of the initial render functions created before rendering.
<private>
{Array}
_selectedDates
The private list of initially selected dates.
{Array[](Integer[])}
cellDates
The collection of calendar cell dates that is parallel to the cells collection. The array contains dates field arrays in the format of [YYYY, M, D].
{HTMLTableCellElement[]}
cells
The collection of calendar table cells
Config
Container for the CSS style configuration variables.
<static>
{String}
YAHOO.widget.Calendar_Core.DATE
Type constant used for renderers to represent an individual date (M/D/Y)
<static>
{Integer}
YAHOO.widget.Calendar_Core.DISPLAY_DAYS
Constant that represents the total number of date cells that are displayed in a given month
including
{HTMLTableCellElement}
headerCell
The HTML cell element that represents the main header cell TH used in the calendar table
{String}
id
The id that uniquely identifies this calendar. This id should match the id of the placeholder element on the page.
<static>
{String}
YAHOO.widget.Calendar_Core.IMG_ROOT
The path to be used for images loaded for the Calendar
{Integer}
index
The index of this item in the parent group
{Date}
maxDate
A Date object representing the maximum selectable date
{Date}
minDate
A Date object representing the minimum selectable date
<static>
{String}
YAHOO.widget.Calendar_Core.MONTH
Type constant used for renderers to represent a month across any year
<static>
{String}
YAHOO.widget.Calendar_Core.MONTH_DAY
Type constant used for renderers to represent an individual date across any year (M/D)
{HTMLElement}
oDomContainer
The DOM element reference that points to this calendar's container element. The calendar will be inserted into this element when the shell is rendered.
{Date}
pageDate
A Date object representing the month/year that the calendar is currently set to
{CalendarGroup}
parent
The parent CalendarGroup, only to be set explicitly by the parent group
<static>
{String}
YAHOO.widget.Calendar_Core.RANGE
Type constant used for renderers to represent a range of individual dates (M/D/Y-M/D/Y)
{Array[]}
renderStack
The list of render functions, along with required parameters, used to render cells.
{Array[](Integer[])}
selectedDates
The list of currently selected dates. The data format for this local collection is
an array of date field arrays, e.g:
[
[2004,5,25],
[2004,5,26]
]
{Boolean}
shellRendered
A boolean indicating whether the shell of the calendar has already been rendered to the page
<static>
{String}
YAHOO.widget.Calendar_Core.STOP_RENDER
Constant used for halting the execution of the remainder of the render stack
{HTMLTableElement}
table
The HTML table element that represents this calendar
{Date}
today
A Date object representing today's date.
<static>
{String}
YAHOO.widget.Calendar_Core.WEEKDAY
Type constant used for renderers to represent a weekday
{HTMLTableCellElement[]}
weekFooterCells
The collection of calendar week footer cells
{HTMLTableCellElement[]}
weekHeaderCells
The collection of calendar week header cells
Method Detail
<private>
_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:
- {String} type
- The type string that indicates the type of date renderer being added. Values are YAHOO.widget.Calendar_Core.DATE, YAHOO.widget.Calendar_Core.MONTH_DAY, YAHOO.widget.Calendar_Core.WEEKDAY, YAHOO.widget.Calendar_Core.RANGE, YAHOO.widget.Calendar_Core.MONTH
- {Array} aDates
- An array of dates used to construct the renderer. The format varies based on the renderer type
- {Function} fnRender
- The function executed to render cells that match the render rules for this renderer.
<private>
{Boolean}
_fieldArraysAreEqual(array1, array2)
Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.
- Parameters:
- {Integer[]} array1
- The first date field array to compare
- {Integer[]} array2
- The first date field array to compare
- Returns:
- The boolean that represents the equality of the two arrays
<private> <static>
{String}
YAHOO.widget.Calendar_Core._getBrowser()
Returns a string representing the current browser.
<private>
{Integer}
_indexOfSelectedFieldArray(find)
Gets the index of a date field array [yyyy,mm,dd] in the current list of selected dates.
- Parameters:
- {Integer[]} find
- The date field array to search for
- Returns:
- The index of the date field array within the collection of selected dates. -1 will be returned if the date is not found.
<private>
{Array[](Integer[])}
_parseDate(sDate)
Converts a date string to a date field array
- Parameters:
- {String} sDate
- Date string. Valid formats are mm/dd and mm/dd/yyyy.
- Returns:
- A date field array representing the string passed to the method
<private>
{Array[](Integer[])}
_parseDates(sDates)
Converts a multi or single-date string to an array of date field arrays
- Parameters:
- {String} sDates
- Date string with one or more comma-delimited dates. Valid formats are mm/dd, mm/dd/yyyy, mm/dd/yyyy-mm/dd/yyyy
- Returns:
- An array of date field arrays
<private>
{Array[](Integer[])}
_parseRange(startDate, endDate)
Converts a date range to the full list of included dates
- Parameters:
- {Integer[]} startDate
- Date field array representing the first date in the range
- {Integer[]} endDate
- Date field array representing the last date in the range
- Returns:
- An array of date field arrays
<private>
{Date}
_toDate(dateFieldArray)
Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.
- Parameters:
- {Integer[]} dateFieldArray
- The date field array to convert to a JavaScript Date.
- Returns:
- JavaScript Date object representing the date field array
<private>
{Array[](Integer[])}
_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:
- {String/Date/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 of date field arrays
<private>
_unload(e, cal)
- Parameters:
- e
- cal
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:
- {Integer} month
- The month (1-12) to associate with this renderer
- {Function} fnRender
- The function executed to render cells that match the render rules for this renderer.
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:
- {Integer} count
- The number of months to add to the current calendar
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:
- {String} sDates
- 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)
- {Function} fnRender
- The function executed to render cells that match the render rules for this renderer.
addWeekdayRenderer(weekay, 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:
- {Integer} weekay
- The weekday (1-7) to associate with this renderer
- {Function} fnRender
- The function executed to render cells that match the render rules for this renderer.
addYears(count)
Adds the designated number of years to the current calendar, and sets the current
calendar page date to the new month.
- Parameters:
- {Integer} count
- The number of years to add to the current calendar
{String}
buildDayLabel(workingDate)
Builds the date digit that will be displayed in calendar cells
- Parameters:
- workingDate
- Returns:
- The formatted day label
{String}
buildMonthLabel()
Builds the date label that will be displayed in the calendar header or
footer, depending on configuration.
- Returns:
- The formatted calendar month label
buildShell()
Builds the calendar table shell that will be filled in with dates and formatting.
This method calls buildShellHeader, buildShellBody, and buildShellFooter (in that order)
to construct the pieces of the calendar table. The construction of the shell should
only happen one time when the calendar is initialized.
buildShellBody()
Builds the calendar shell body (6 weeks by 7 days)
buildShellFooter()
Builds the calendar shell footer. In the default implementation, there is
no footer.
buildShellHeader()
Builds the calendar shell header by inserting a THEAD into the local calendar table.
clear()
Clears the selected dates in the current calendar widget and sets the calendar
to the current month and year.
clearAllBodyCellStyles(The)
Removes all styles from all body cells in the current calendar table.
- Parameters:
- {style} The
- CSS class name to remove from all calendar body cells
clearElement(The)
Clears the inner HTML, CSS class and style information from the specified cell.
- Parameters:
- {HTMLTableCellElement} The
- cell to clear
customConfig()
This method is called when subclasses need to override configuration variables
or create new ones. Values can be explicitly set as follows:
this.Config.Style.CSS_CELL = "newcalcell";
this.Config.Locale.MONTHS_SHORT = ["Jan", "Fv", "Mars", "Avr", "Mai", "Juin", "Juil", "Aot", "Sept", "Oct", "Nov", "Dc"];
{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:
- {String/Date/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 of JavaScript Date objects representing all individual dates that are currently selected.
{Date[]}
deselectAll()
Deselects all dates on the current calendar.
- Returns:
- 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:
- {Integer} cellIndex
- The index of the cell to deselect in the current calendar.
- Returns:
- Array of JavaScript Date objects representing all individual dates that are currently selected.
<private>
doCellMouseOut(e, cal)
The event that is executed when the user moves the mouse out of a cell
- Parameters:
- e
- The event
- cal
- A reference to the calendar passed by the Event utility
<private>
doCellMouseOver(e, cal)
The event that is executed when the user hovers over a cell
- Parameters:
- e
- The event
- cal
- A reference to the calendar passed by the Event utility
<private>
doNextMonth(e, cal)
A wrapper event that executes the nextMonth method through a DOM event
- Parameters:
- e
- The event
- cal
- A reference to the calendar passed by the Event utility
<private>
doPreviousMonth(e, cal)
A wrapper event that executes the previousMonth method through a DOM event
- Parameters:
- e
- The event
- cal
- A reference to the calendar passed by the Event utility
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
- The event
- cal
- A reference to the calendar passed by the Event utility
{Date[]}
getSelectedDates()
Gets the list of currently selected dates from the calendar.
- Returns:
- An array of currently selected JavaScript Date objects.
init(id, containerId, monthyear, selected)
Initializes the calendar widget. This method must be called by all subclass constructors.
- Parameters:
- {String} id
- The id of the table element that will represent the calendar widget
- {String} containerId
- The id of the container element that will contain the calendar table
- {String} monthyear
- The month/year string used to set the current calendar page
- {String} selected
- A string of date values formatted using the date parser. The built-in default date format is MM/DD/YYYY. Ranges are defined using MM/DD/YYYY-MM/DD/YYYY. Month/day combinations are defined using MM/DD. Any combination of these can be combined by delimiting the string with commas. Example: "12/24/2005,12/25,1/18/2006-1/21/2006"
{Boolean}
isDateOOM(date)
Determines whether a given date is OOM (out of month).
- Parameters:
- {Date} date
- The JavaScript Date object for which to check the OOM status
- Returns:
- {Boolean} true if the date is OOM
nextMonth()
Navigates to the next month page in the calendar widget.
nextYear()
Navigates to the next year in the currently selected month in the calendar widget.
onBeforeDeselect()
Event executed before a date is deselected in the calendar widget.
onBeforeSelect()
Event executed before a date is selected in the calendar widget.
onChangePage()
Event executed when the user navigates to a different calendar page.
onClear()
Event executed when the calendar widget is completely cleared to the current month with no selections.
onDeselect()
Event executed when a date is deselected in the calendar widget.
onRender()
Event executed when the calendar widget is rendered.
onReset()
Event executed when the calendar widget is reset to its original state.
onSelect()
Event executed when a date is selected in the calendar widget.
previousMonth()
Navigates to the previous month page in the calendar widget.
previousYear()
Navigates to the previous year in the currently selected month in the calendar widget.
render()
Renders the calendar after it has been configured. The render() method has a specific call chain that will execute
when the method is called: renderHeader, renderBody, renderFooter.
Refer to the documentation for those methods for information on
individual render tasks.
renderBody(workingDate)
Appends the calendar body. The default implementation calculates the number of
OOM (out of month) cells that need to be rendered at the start of the month, renders those,
and renders all the day cells using the built-in cell rendering methods.
While iterating through all of the cells, the calendar checks for renderers in the
local render stack that match the date of the current cell, and then applies styles
as necessary.
- Parameters:
- {Date} workingDate
- The current working Date object being used to generate the calendar
{String}
renderBodyCellRestricted(workingDate, cell)
Renders the current calendar cell as a non-selectable "black-out" date using the default
restricted style.
- Parameters:
- {Date} workingDate
- The current working Date object being used to generate the calendar
- {HTMLTableCellElement} cell
- The current working cell in the calendar
- Returns:
- YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering should not be terminated
{String}
renderCellDefault(workingDate, cell)
Renders a single standard calendar cell in the calendar widget table.
All logic for determining how a standard default cell will be rendered is
encapsulated in this method, and must be accounted for when extending the
widget class.
- Parameters:
- {Date} workingDate
- The current working Date object being used to generate the calendar
- {HTMLTableCellElement} cell
- The current working cell in the calendar
- Returns:
- YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering should not be terminated
{String}
renderCellNotThisMonth(workingDate, cell)
Applies the default style used for rendering dates that are not a part of the current
month (preceding or trailing the cells for the current month)
- Parameters:
- {Date} workingDate
- The current working Date object being used to generate the calendar
- {HTMLTableCellElement} cell
- The current working cell in the calendar
- Returns:
- YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering should not be terminated
{String}
renderCellStyleHighlight1(workingDate, cell)
Renders a single standard calendar cell using the CSS hightlight1 style
- Parameters:
- {Date} workingDate
- The current working Date object being used to generate the calendar
- {HTMLTableCellElement} cell
- The current working cell in the calendar
- Returns:
- YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering should not be terminated
{String}
renderCellStyleHighlight2(workingDate, cell)
Renders a single standard calendar cell using the CSS hightlight2 style
- Parameters:
- {Date} workingDate
- The current working Date object being used to generate the calendar
- {HTMLTableCellElement} cell
- The current working cell in the calendar
- Returns:
- YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering should not be terminated
{String}
renderCellStyleHighlight3(workingDate, cell)
Renders a single standard calendar cell using the CSS hightlight3 style
- Parameters:
- {Date} workingDate
- The current working Date object being used to generate the calendar
- {HTMLTableCellElement} cell
- The current working cell in the calendar
- Returns:
- YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering should not be terminated
{String}
renderCellStyleHighlight4(workingDate, cell)
Renders a single standard calendar cell using the CSS hightlight4 style
- Parameters:
- {Date} workingDate
- The current working Date object being used to generate the calendar
- {HTMLTableCellElement} cell
- The current working cell in the calendar
- Returns:
- YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering should not be terminated
{String}
renderCellStyleSelected(workingDate, cell)
Applies the default style used for rendering selected dates to the current calendar cell
- Parameters:
- {Date} workingDate
- The current working Date object being used to generate the calendar
- {HTMLTableCellElement} cell
- The current working cell in the calendar
- Returns:
- YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering should not be terminated
{String}
renderCellStyleToday(workingDate, cell)
Applies the default style used for rendering today's date to the current calendar cell
- Parameters:
- {Date} workingDate
- The current working Date object being used to generate the calendar
- {HTMLTableCellElement} cell
- The current working cell in the calendar
- Returns:
- YAHOO.widget.Calendar_Core.STOP_RENDER if rendering should stop with this style, null or nothing if rendering should not be terminated
renderFooter()
Appends the contents of the calendar widget footer into the shell. By default,
the calendar does not contain a footer, and this method must be implemented by
subclassing the widget.
renderHeader()
Appends the header contents into the widget header.
renderOutOfBoundsDate(workingDate, cell)
*************** BEGIN BUILT-IN TABLE CELL RENDERERS ***********************************
- Parameters:
- workingDate
- cell
renderRowFooter(workingDate, cell)
Renders the row footer for a week. The date passed in should be
the first date of the given week.
- Parameters:
- {Date} workingDate
- The current working Date object (beginning of the week) being used to generate the calendar
- {HTMLTableCellElement} cell
- The current working cell in the calendar
renderRowHeader(workingDate, cell)
Renders the row header for a week. The date passed in should be
the first date of the given week.
- Parameters:
- {Date} workingDate
- The current working Date object (beginning of the week) being used to generate the calendar
- {HTMLTableCellElement} cell
- The current working cell in the calendar
renderShell()
Outputs the calendar shell to the DOM, inserting it into the placeholder element.
reset()
Resets the calendar widget to the originally selected month and year, and
sets the calendar to the initial selection(s).
resetRenderers()
Resets the render stack of the current calendar to its original pre-render value.
{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:
- {String/Date/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:
- Array of JavaScript Date objects representing all individual dates that are currently selected.
{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:
- {Integer} cellIndex
- The index of the cell to select in the current calendar.
- Returns:
- Array of JavaScript Date objects representing all individual dates that are currently selected.
<static>
YAHOO.widget.Calendar_Core.setCssClasses(element, aStyles)
Sets the specified array of CSS classes into the referenced element
- Parameters:
- {HTMLElement} element
- The element to set the CSS classes into
- {String[]} aStyles
- An array of CSS class names
setMonth(month)
Sets the calendar's month explicitly.
- Parameters:
- {Integer} month
- The numeric month, from 1 (January) to 12 (December)
setupConfig()
This method is called to initialize the widget configuration variables, including
style, localization, and other display and behavioral options.
Config: Container for the CSS style configuration variables.
Config.Style - Defines the CSS classes used for different calendar elements
CSS_CALENDAR : Container tableCSS_HEADER :CSS_HEADER_TEXT : Calendar headerCSS_FOOTER : Calendar footerCSS_CELL : Calendar day cellCSS_CELL_OOM : Calendar OOM (out of month) cellCSS_CELL_SELECTED : Calendar selected cellCSS_CELL_RESTRICTED : Calendar restricted cellCSS_CELL_TODAY : Calendar cell for today's dateCSS_ROW_HEADER : The cell preceding a row (used for week number by default)CSS_ROW_FOOTER : The cell following a row (not implemented by default)CSS_WEEKDAY_CELL : The cells used for labeling weekdaysCSS_WEEKDAY_ROW : The row containing the weekday label cellsCSS_CONTAINER : The border style used for the default UED renderingCSS_2UPWRAPPER : Special container class used to properly adjust the sizing and floatCSS_NAV_LEFT : Left navigation arrowCSS_NAV_RIGHT : Right navigation arrowCSS_CELL_TOP : Outlying cell along the top rowCSS_CELL_LEFT : Outlying cell along the left rowCSS_CELL_RIGHT : Outlying cell along the right rowCSS_CELL_BOTTOM : Outlying cell along the bottom rowCSS_CELL_HOVER : Cell hover styleCSS_CELL_HIGHLIGHT1 : Highlight color 1 for styling cellsCSS_CELL_HIGHLIGHT2 : Highlight color 2 for styling cellsCSS_CELL_HIGHLIGHT3 : Highlight color 3 for styling cellsCSS_CELL_HIGHLIGHT4 : Highlight color 4 for styling cells
Config.Locale - Defines the locale string arrays used for localization
MONTHS_SHORT : Array of 12 months in short format ("Jan", "Feb", etc.)MONTHS_LONG : Array of 12 months in short format ("Jan", "Feb", etc.)WEEKDAYS_1CHAR : Array of 7 days in 1-character format ("S", "M", etc.)WEEKDAYS_SHORT : Array of 7 days in short format ("Su", "Mo", etc.)WEEKDAYS_MEDIUM : Array of 7 days in medium format ("Sun", "Mon", etc.)WEEKDAYS_LONG : Array of 7 days in long format ("Sunday", "Monday", etc.)DATE_DELIMITER : The value used to delimit series of multiple dates (Default: ",")DATE_FIELD_DELIMITER : The value used to delimit date fields (Default: "/")DATE_RANGE_DELIMITER : The value used to delimit date fields (Default: "-")MY_MONTH_POSITION : The value used to determine the position of the month in a month/year combo (e.g. 12/2005) (Default: 1)MY_YEAR_POSITION : The value used to determine the position of the year in a month/year combo (e.g. 12/2005) (Default: 2)MD_MONTH_POSITION : The value used to determine the position of the month in a month/day combo (e.g. 12/25) (Default: 1)MD_DAY_POSITION : The value used to determine the position of the day in a month/day combo (e.g. 12/25) (Default: 2)MDY_MONTH_POSITION : The value used to determine the position of the month in a month/day/year combo (e.g. 12/25/2005) (Default: 1)MDY_DAY_POSITION : The value used to determine the position of the day in a month/day/year combo (e.g. 12/25/2005) (Default: 2)MDY_YEAR_POSITION : The value used to determine the position of the year in a month/day/year combo (e.g. 12/25/2005) (Default: 3)
Config.Options - Defines other configurable calendar widget options
SHOW_WEEKDAYS : Boolean, determines whether to display the weekday headers (defaults to true)LOCALE_MONTHS : Array, points to the desired Config.Locale array (defaults to Config.Locale.MONTHS_LONG)LOCALE_WEEKDAYS : Array, points to the desired Config.Locale array (defaults to Config.Locale.WEEKDAYS_SHORT)START_WEEKDAY : Integer, 0-6, representing the day that a week begins onSHOW_WEEK_HEADER : Boolean, determines whether to display row headersSHOW_WEEK_FOOTER : Boolean, determines whether to display row footersHIDE_BLANK_WEEKS : Boolean, determines whether to hide extra weeks that are completely OOMNAV_ARROW_LEFT : String, the image path used for the left navigation arrowNAV_ARROW_RIGHT : String, the image path used for the right navigation arrow
setYear(year)
Sets the calendar's year explicitly.
- Parameters:
- {Integer} year
- The numeric 4-digit year
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:
- {Integer} count
- The number of months to subtract from the current calendar
subtractYears(count)
Subtcats the designated number of years from the current calendar, and sets the current
calendar page date to the new month.
- Parameters:
- {Integer} count
- The number of years to subtract from the current calendar
{string}
toString()
Returns a string representation of the object.
{Boolean}
validate()
Validates the calendar widget. This method has no default implementation
and must be extended by subclassing the widget.
- Returns:
- Should return true if the widget validates, and false if it doesn't.
wireCustomEvents()
This function can be extended by subclasses to attach additional DOM events to
the calendar. By default, this method is unimplemented.
wireDefaultEvents()
Wires the local DOM events for the Calendar, including cell selection, hover, and
default navigation that is used for moving back and forth between calendar pages.