Print Friendly

Class YAHOO.widget.Calendar

Package:YAHOO.widget
Class:Calendar
Extends:Object
Subclasses:Calendar_Core
Defined In:calendar.js
Calendar 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:

<div id="cal1Container"></div> Note that the table can be replaced with any kind of element.


Public Properties

Property Defined By
  CSS_CALENDAR : Object Calendar
  CSS_CELL : Object Calendar
  CSS_CELL_BOTTOM : Object Calendar
  CSS_CELL_HIGHLIGHT1 : Object Calendar
  CSS_CELL_HIGHLIGHT2 : Object Calendar
  CSS_CELL_HIGHLIGHT3 : Object Calendar
  CSS_CELL_HIGHLIGHT4 : Object Calendar
  CSS_CELL_HOVER : Object Calendar
  CSS_CELL_LEFT : Object Calendar
  CSS_CELL_OOB : Object Calendar
  CSS_CELL_OOM : Object Calendar
  CSS_CELL_RESTRICTED : Object Calendar
  CSS_CELL_RIGHT : Object Calendar
  CSS_CELL_SELECTABLE : Object Calendar
  CSS_CELL_SELECTED : Object Calendar
  CSS_CELL_TODAY : Object Calendar
  CSS_CELL_TOP : Object Calendar
  CSS_CONTAINER : Object Calendar
  CSS_FOOTER : Object Calendar
  CSS_HEADER : Object Calendar
  CSS_HEADER_TEXT : Object Calendar
  CSS_NAV_LEFT : Object Calendar
  CSS_NAV_RIGHT : Object Calendar
  CSS_ROW_FOOTER : Object Calendar
  CSS_ROW_HEADER : Object Calendar
  CSS_SINGLE : Object Calendar
  CSS_WEEKDAY_CELL : Object Calendar
  CSS_WEEKDAY_ROW : Object Calendar
  DATE<static> : String Calendar
<static> Type constant used for renderers to represent an individual date (M/D/Y)
  DISPLAY_DAYS<static> : Number Calendar
<static> Constant that represents the total number of date cells that are displayed in a given month
  Locale : Object Calendar
The local object which contains the Calendar's locale settings
  MONTH<static> : String Calendar
<static> Type constant used for renderers to represent a month across any year
  MONTH_DAY<static> : String Calendar
<static> Type constant used for renderers to represent an individual date across any year (M/D)
  Options : Object Calendar
The local object which contains the Calendar's options
  RANGE<static> : String Calendar
<static> Type constant used for renderers to represent a range of individual dates (M/D/Y-M/D/Y)
  STOP_RENDER<static> : String Calendar
<static> Constant used for halting the execution of the remainder of the render stack
  Style : Object Calendar
Collection of Style constants for the Calendar
  WEEKDAY<static> : String Calendar
<static> Type constant used for renderers to represent a weekday
  browser : String Calendar
Returns a string representing the current browser.
  cellDates : Array[](Number[]) Calendar
The collection of calendar cell dates that is parallel to the cells collection. The array contains dates field arrays...
  cells : HTMLTableCellElement[] Calendar
The collection of calendar table cells
  cfg : YAHOO.util.Config Calendar
The Config object used to hold the configuration variables for the Calendar
  domEventMap : Object Calendar
A map of DOM event handlers to attach to cells associated with specific CSS class names
  https : String Calendar
<static> The path to be used for images loaded for the Calendar
  id : String Calendar
The id that uniquely identifies this calendar. This id should match the id of the placeholder element on the page.
  index : Number Calendar
The index of this item in the parent group
  oDomContainer : HTMLElement Calendar
The DOM element reference that points to this calendar's container element. The calendar will be inserted into this e...
  parent : CalendarGroup Calendar
The parent CalendarGroup, only to be set explicitly by the parent group
  renderStack : Array[] Calendar
The list of render functions, along with required parameters, used to render cells.
  today : Date Calendar
A Date object representing today's date.

Public Methods

Method Defined By
  Calendar(String id, String containerId, Object config) Calendar
  addMonthRenderer(Number month, Function fnRender) : void Calendar
Adds a month to the render stack. The function reference passed to this method will be executed when a date cell matc...
  addMonths(Number count) : void Calendar
Adds the designated number of months to the current calendar month, and sets the current calendar page date to the ne...
  addRenderer(String sDates, Function fnRender) : void Calendar
Adds a renderer to the render stack. The function reference passed to this method will be executed when a date cell m...
  addWeekdayRenderer(Number weekday, Function fnRender) : void Calendar
Adds a weekday to the render stack. The function reference passed to this method will be executed when a date cell ma...
  addYears(Number count) : void Calendar
Adds the designated number of years to the current calendar, and sets the current calendar page date to the new month.
  applyListeners() : void Calendar
Applies the Calendar's DOM listeners to applicable elements.
  buildDayLabel(Date workingDate) : String Calendar
Builds the date digit that will be displayed in calendar cells
  buildMonthLabel() : String Calendar
Builds the date label that will be displayed in the calendar header or footer, depending on configuration.
  buildWeekdays(Array html) : Array Calendar
Renders the Calendar's weekday headers.
  clear() : void Calendar
Clears the selected dates in the current calendar widget and sets the calendar to the current month and year.
  clearAllBodyCellStyles(style The) : void Calendar
Removes all styles from all body cells in the current calendar table.
  clearElement(HTMLTableCellElement The) : void Calendar
Clears the inner HTML, CSS class and style information from the specified cell.
  configClose() : void Calendar
Default handler for the "close" property
  configIframe() : void Calendar
Renders the built-in IFRAME shim for the IE6 and below
  configLocale() : void Calendar
The default handler for all configuration locale properties
  configLocaleValues() : void Calendar
The default handler for all configuration locale field length properties
  configMaxDate() : void Calendar
The default handler for the "maxdate" property
  configMinDate() : void Calendar
The default handler for the "mindate" property
  configOptions() : void Calendar
The default handler for all configuration options properties
  configPageDate() : void Calendar
The default handler for the "pagedate" property
  configSelected() : void Calendar
The default handler for the "selected" property
  configTitle() : void Calendar
Default handler for the "title" property
  deselect(String/Date/Date[] date) : Date[] Calendar
Deselects a date or a collection of dates on the current calendar. This method, by default, does not call the render ...
  deselectAll() : Date[] Calendar
Deselects all dates on the current calendar.
  deselectCell(Number cellIndex) : Date[] Calendar
Deselects a date on the current calendar by referencing the index of the cell that should be deselected. This method ...
  doCellMouseOut(DOMEvent e, Calendar cal) : void Calendar
The event that is executed when the user moves the mouse out of a cell
  doCellMouseOver(DOMEvent e, Calendar cal) : void Calendar
The event that is executed when the user hovers over a cell
  doSelectCell(DOMEvent e, Calendar cal) : void Calendar
The default event function that is attached to a date link within a calendar cell when the calendar is rendered.
  getDateByCellId(String id) : Date Calendar
Retrieves the Date object for the specified Calendar cell
  getDateFieldsByCellId(String id) : Array Calendar
Retrieves the Date object for the specified Calendar cell
  getSelectedDates() : Date[] Calendar
Gets the list of currently selected dates from the calendar.
  hide() : void Calendar
Hides the Calendar's outer container from view.
  init(String id, String containerId, Object config) : void Calendar
Initializes the Calendar widget.
  initEvents() : void Calendar
Initializes Calendar's built-in CustomEvents
  initStyles() : void Calendar
Defines the style constants for the Calendar
  isDateOOM(Date date) : Boolean Calendar
Determines whether a given date is OOM (out of month).
  nextMonth() : void Calendar
Navigates to the next month page in the calendar widget.
  nextYear() : void Calendar
Navigates to the next year in the currently selected month in the calendar widget.
  onBeforeDeselect() : void Calendar
Deprecated. Event executed before a date is deselected in the calendar widget.
  onBeforeSelect() : void Calendar
Deprecated. Event executed before a date is selected in the calendar widget.
  onChangePage() : void Calendar
Deprecated. Event executed when the user navigates to a different calendar page.
  onDeselect(Array selected) : void Calendar
Deprecated. Event executed when a date is deselected in the calendar widget.
  onRender() : void Calendar
Deprecated. Event executed when the calendar widget is rendered.
  onSelect(Array selected) : void Calendar
Deprecated. Event executed when a date is selected in the calendar widget.
  previousMonth() : void Calendar
Navigates to the previous month page in the calendar widget.
  previousYear() : void Calendar
Navigates to the previous year in the currently selected month in the calendar widget.
  render() : void Calendar
Deprecated. Event executed when the calendar widget is completely cleared to the current month with no selections.
  renderBody(Date workingDate, Array html) : Array Calendar
Renders the calendar body.
  renderBodyCellRestricted(Date workingDate, HTMLTableCellElement cell) : String Calendar
Renders the current calendar cell as a non-selectable "black-out" date using the default restricted style.
  renderCellDefault(Date workingDate, HTMLTableCellElement cell) : void Calendar
Renders a single standard calendar cell in the calendar widget table. All logic for determining how a standard defaul...
  renderCellNotThisMonth(Date workingDate, HTMLTableCellElement cell) : String Calendar
Applies the default style used for rendering dates that are not a part of the current month (preceding or trailing th...
  renderCellStyleHighlight1(Date workingDate, HTMLTableCellElement cell) : void Calendar
Renders a single standard calendar cell using the CSS hightlight1 style
  renderCellStyleHighlight2(Date workingDate, HTMLTableCellElement cell) : void Calendar
Renders a single standard calendar cell using the CSS hightlight2 style
  renderCellStyleHighlight3(Date workingDate, HTMLTableCellElement cell) : void Calendar
Renders a single standard calendar cell using the CSS hightlight3 style
  renderCellStyleHighlight4(Date workingDate, HTMLTableCellElement cell) : void Calendar
Renders a single standard calendar cell using the CSS hightlight4 style
  renderCellStyleSelected(Date workingDate, HTMLTableCellElement cell) : String Calendar
Applies the default style used for rendering selected dates to the current calendar cell
  renderCellStyleToday(Date workingDate, HTMLTableCellElement cell) : void Calendar
Applies the default style used for rendering today's date to the current calendar cell
  renderFooter(Array html) : Array Calendar
Renders the calendar footer. In the default implementation, there is no footer.
  renderHeader(Array html) : Array Calendar
Renders the calendar header.
  renderOutOfBoundsDate(Date workingDate, HTMLTableCellElement cell) : String Calendar
Renders a cell that falls before the minimum date or after the maximum date. widget class.
  renderRowFooter(Number weekNum, Array cell) : void Calendar
Renders the row footer for a week.
  renderRowHeader(Number weekNum, Array cell) : void Calendar
Renders the row header for a week.
  reset() : void Calendar
Resets the calendar widget to the originally selected month and year, and sets the calendar to the initial selection(s).
  resetRenderers() : void Calendar
Resets the render stack of the current calendar to its original pre-render value.
  select(String/Date/Date[] date) : Date[] Calendar
Selects a date or a collection of dates on the current calendar. This method, by default, does not call the render me...
  selectCell(Number cellIndex) : Date[] Calendar
Selects a date on the current calendar by referencing the index of the cell that should be selected. This method is u...
  setMonth(Number month) : void Calendar
Sets the calendar's month explicitly
  setYear(Number year) : void Calendar
Sets the calendar's year explicitly.
  show() : void Calendar
Shows the Calendar's outer container.
  styleCellDefault(Date workingDate, HTMLTableCellElement cell) : void Calendar
Styles a selectable cell.
  subtractMonths(Number count) : void Calendar
Subtracts the designated number of months from the current calendar month, and sets the current calendar page date to...
  subtractYears(Number count) : void Calendar
Subtcats the designated number of years from the current calendar, and sets the current calendar page date to the new...
  toString() : String Calendar
Returns a string representation of the object.
  validate() : Should Calendar
Validates the calendar widget. This method has no default implementation and must be extended by subclassing the widget.

Public Events

Event Defined By
  beforeDeselectEvent : () Calendar
Fired before a selection is made
  beforeRenderEvent : () Calendar
Fired before the Calendar is rendered
  beforeSelectEvent : () Calendar
Fired before a selection is made
  changePageEvent : () Calendar
Fired when the Calendar page is changed
  clearEvent : () Calendar
Fired when the Calendar is cleared
  deselectEvent : (Array Array) Calendar
Fired when a selection is made
  renderEvent : () Calendar
Fired when the Calendar is rendered
  resetEvent : () Calendar
Fired when the Calendar is reset
  selectEvent : (Array Array) Calendar
Fired when a selection is made

Property Details

CSS_CALENDAR

public Object CSS_CALENDAR
This property is defined by Calendar.

CSS_CELL

public Object CSS_CELL
This property is defined by Calendar.

CSS_CELL_BOTTOM

public Object CSS_CELL_BOTTOM
This property is defined by Calendar.

CSS_CELL_HIGHLIGHT1

public Object CSS_CELL_HIGHLIGHT1
This property is defined by Calendar.

CSS_CELL_HIGHLIGHT2

public Object CSS_CELL_HIGHLIGHT2
This property is defined by Calendar.

CSS_CELL_HIGHLIGHT3

public Object CSS_CELL_HIGHLIGHT3
This property is defined by Calendar.

CSS_CELL_HIGHLIGHT4

public Object CSS_CELL_HIGHLIGHT4
This property is defined by Calendar.

CSS_CELL_HOVER

public Object CSS_CELL_HOVER
This property is defined by Calendar.

CSS_CELL_LEFT

public Object CSS_CELL_LEFT
This property is defined by Calendar.

CSS_CELL_OOB

public Object CSS_CELL_OOB
This property is defined by Calendar.

CSS_CELL_OOM

public Object CSS_CELL_OOM
This property is defined by Calendar.

CSS_CELL_RESTRICTED

public Object CSS_CELL_RESTRICTED
This property is defined by Calendar.

CSS_CELL_RIGHT

public Object CSS_CELL_RIGHT
This property is defined by Calendar.

CSS_CELL_SELECTABLE

public Object CSS_CELL_SELECTABLE
This property is defined by Calendar.

CSS_CELL_SELECTED

public Object CSS_CELL_SELECTED
This property is defined by Calendar.

CSS_CELL_TODAY

public Object CSS_CELL_TODAY
This property is defined by Calendar.

CSS_CELL_TOP

public Object CSS_CELL_TOP
This property is defined by Calendar.

CSS_CONTAINER

public Object CSS_CONTAINER
This property is defined by Calendar.

CSS_FOOTER

public Object CSS_FOOTER
This property is defined by Calendar.

CSS_HEADER

public Object CSS_HEADER
This property is defined by Calendar.

CSS_HEADER_TEXT

public Object CSS_HEADER_TEXT
This property is defined by Calendar.

CSS_NAV_LEFT

public Object CSS_NAV_LEFT
This property is defined by Calendar.

CSS_NAV_RIGHT

public Object CSS_NAV_RIGHT
This property is defined by Calendar.

CSS_ROW_FOOTER

public Object CSS_ROW_FOOTER
This property is defined by Calendar.

CSS_ROW_HEADER

public Object CSS_ROW_HEADER
This property is defined by Calendar.

CSS_SINGLE

public Object CSS_SINGLE
This property is defined by Calendar.

CSS_WEEKDAY_CELL

public Object CSS_WEEKDAY_CELL
This property is defined by Calendar.

CSS_WEEKDAY_ROW

public Object CSS_WEEKDAY_ROW
This property is defined by Calendar.

DATE<static>

public String DATE<static>
<static> Type constant used for renderers to represent an individual date (M/D/Y)
This property is defined by Calendar.

DISPLAY_DAYS<static>

public Number DISPLAY_DAYS<static>
<static> Constant that represents the total number of date cells that are displayed in a given month
This property is defined by Calendar.

Locale

public Object Locale
The local object which contains the Calendar's locale settings
This property is defined by Calendar.

MONTH<static>

public String MONTH<static>
<static> Type constant used for renderers to represent a month across any year
This property is defined by Calendar.

MONTH_DAY<static>

public String MONTH_DAY<static>
<static> Type constant used for renderers to represent an individual date across any year (M/D)
This property is defined by Calendar.

Options

public Object Options
The local object which contains the Calendar's options
This property is defined by Calendar.

RANGE<static>

public String RANGE<static>
<static> Type constant used for renderers to represent a range of individual dates (M/D/Y-M/D/Y)
This property is defined by Calendar.

STOP_RENDER<static>

public String STOP_RENDER<static>
<static> Constant used for halting the execution of the remainder of the render stack
This property is defined by Calendar.

Style

public Object Style
Collection of Style constants for the Calendar
This property is defined by Calendar.

WEEKDAY<static>

public String WEEKDAY<static>
<static> Type constant used for renderers to represent a weekday
This property is defined by Calendar.

browser

public String browser
Returns a string representing the current browser.
This property is defined by Calendar.

cellDates

public Array[](Number[]) 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].
This property is defined by Calendar.

cells

public HTMLTableCellElement[] cells
The collection of calendar table cells
This property is defined by Calendar.

cfg

public YAHOO.util.Config cfg
The Config object used to hold the configuration variables for the Calendar
This property is defined by Calendar.

domEventMap

public Object domEventMap
A map of DOM event handlers to attach to cells associated with specific CSS class names
This property is defined by Calendar.

https

public String https
<static> The path to be used for images loaded for the Calendar
This property is defined by Calendar.

id

public String id
The id that uniquely identifies this calendar. This id should match the id of the placeholder element on the page.
This property is defined by Calendar.

index

public Number index
The index of this item in the parent group
This property is defined by Calendar.

oDomContainer

public 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.
This property is defined by Calendar.

parent

public CalendarGroup parent
The parent CalendarGroup, only to be set explicitly by the parent group
This property is defined by Calendar.

renderStack

public Array[] renderStack
The list of render functions, along with required parameters, used to render cells.
This property is defined by Calendar.

today

public Date today
A Date object representing today's date.
This property is defined by Calendar.

Constructor Details

Calendar

public function Calendar(String id, String containerId, Object 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

Method Details

addMonthRenderer

public function addMonthRenderer(Number month, Function 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
This method is defined by Calendar.

addMonths

public function addMonths(Number 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
This method is defined by Calendar.

addRenderer

public function addRenderer(String sDates, Function 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
This method is defined by Calendar.

addWeekdayRenderer

public function addWeekdayRenderer(Number weekday, Function 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
This method is defined by Calendar.

addYears

public function addYears(Number 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
This method is defined by Calendar.

applyListeners

public function applyListeners()
Applies the Calendar's DOM listeners to applicable elements.
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

buildDayLabel

public function buildDayLabel(Date 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
This method is defined by Calendar.

buildMonthLabel

public function buildMonthLabel()
Builds the date label that will be displayed in the calendar header or footer, depending on configuration.
Parameters:
  • None.
Returns:
  • String
    The formatted calendar month label
This method is defined by Calendar.

buildWeekdays

public function buildWeekdays(Array html)
Renders the Calendar's weekday headers.
Parameters:
  • html : Array
    The current working HTML array
Returns:
  • Array
    The current working HTML array
This method is defined by Calendar.

clear

public function clear()
Clears the selected dates in the current calendar widget and sets the calendar to the current month and year.
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

clearAllBodyCellStyles

public function clearAllBodyCellStyles(style 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
This method is defined by Calendar.

clearElement

public function clearElement(HTMLTableCellElement The)
Clears the inner HTML, CSS class and style information from the specified cell.
Parameters:
  • The : HTMLTableCellElement
    cell to clear
Returns:
  • void
This method is defined by Calendar.

configClose

public function configClose()
Default handler for the "close" property
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

configIframe

public function configIframe()
Renders the built-in IFRAME shim for the IE6 and below
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

configLocale

public function configLocale()
The default handler for all configuration locale properties
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

configLocaleValues

public function configLocaleValues()
The default handler for all configuration locale field length properties
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

configMaxDate

public function configMaxDate()
The default handler for the "maxdate" property
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

configMinDate

public function configMinDate()
The default handler for the "mindate" property
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

configOptions

public function configOptions()
The default handler for all configuration options properties
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

configPageDate

public function configPageDate()
The default handler for the "pagedate" property
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

configSelected

public function configSelected()
The default handler for the "selected" property
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

configTitle

public function configTitle()
Default handler for the "title" property
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

deselect

public function deselect(String/Date/Date[] 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.
This method is defined by Calendar.

deselectAll

public function deselectAll()
Deselects all dates on the current calendar.
Parameters:
  • None.
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.
This method is defined by Calendar.

deselectCell

public function deselectCell(Number 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.
This method is defined by Calendar.

doCellMouseOut

public function doCellMouseOut(DOMEvent e, Calendar 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
This method is defined by Calendar.

doCellMouseOver

public function doCellMouseOver(DOMEvent e, Calendar 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
This method is defined by Calendar.

doSelectCell

public function doSelectCell(DOMEvent e, Calendar 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
This method is defined by Calendar.

getDateByCellId

public function getDateByCellId(String 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
This method is defined by Calendar.

getDateFieldsByCellId

public function getDateFieldsByCellId(String 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
This method is defined by Calendar.

getSelectedDates

public function getSelectedDates()
Gets the list of currently selected dates from the calendar.
Parameters:
  • None.
Returns:
  • Date[]
    An array of currently selected JavaScript Date objects.
This method is defined by Calendar.

hide

public function hide()
Hides the Calendar's outer container from view.
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

init

public function init(String id, String containerId, Object 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
This method is defined by Calendar.

initEvents

public function initEvents()
Initializes Calendar's built-in CustomEvents
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

initStyles

public function initStyles()
Defines the style constants for the Calendar
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

isDateOOM

public function isDateOOM(Date 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
This method is defined by Calendar.

nextMonth

public function nextMonth()
Navigates to the next month page in the calendar widget.
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

nextYear

public function nextYear()
Navigates to the next year in the currently selected month in the calendar widget.
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

onBeforeDeselect

public function onBeforeDeselect()
Deprecated. Event executed before a date is deselected in the calendar widget.
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

onBeforeSelect

public function onBeforeSelect()
Deprecated. Event executed before a date is selected in the calendar widget.
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

onChangePage

public function onChangePage()
Deprecated. Event executed when the user navigates to a different calendar page.
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

onDeselect

public function onDeselect(Array selected)
Deprecated. Event executed when a date is deselected in the calendar widget.
Parameters:
  • selected : Array
    An array of date field arrays representing which date or dates were deselected. Example: [ [2006,8,6],[2006,8,7],[2006,8,8] ]
Returns:
  • void
This method is defined by Calendar.

onRender

public function onRender()
Deprecated. Event executed when the calendar widget is rendered.
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

onSelect

public function onSelect(Array selected)
Deprecated. Event executed when a date is selected in the calendar widget.
Parameters:
  • selected : Array
    An array of date field arrays representing which date or dates were selected. Example: [ [2006,8,6],[2006,8,7],[2006,8,8] ]
Returns:
  • void
This method is defined by Calendar.

previousMonth

public function previousMonth()
Navigates to the previous month page in the calendar widget.
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

previousYear

public function previousYear()
Navigates to the previous year in the currently selected month in the calendar widget.
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

render

public function render()
Deprecated. Event executed when the calendar widget is completely cleared to the current month with no selections.
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

renderBody

public function renderBody(Date workingDate, Array html)
Renders the calendar body.
Parameters:
  • workingDate : Date
    The current working Date being used for the render process
  • html : Array
    The current working HTML array
Returns:
  • Array
    The current working HTML array
This method is defined by Calendar.

renderBodyCellRestricted

public function renderBodyCellRestricted(Date workingDate, HTMLTableCellElement cell)
Renders the current calendar cell as a non-selectable "black-out" date using the default restricted style.
Parameters:
  • workingDate : Date
    The current working Date object being used to generate the calendar
  • cell : HTMLTableCellElement
    The current working cell in the calendar
Returns:
  • String
    YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering should not be terminated
This method is defined by Calendar.

renderCellDefault

public function renderCellDefault(Date workingDate, HTMLTableCellElement 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:
  • workingDate : Date
    The current working Date object being used to generate the calendar
  • cell : HTMLTableCellElement
    The current working cell in the calendar
Returns:
  • void
This method is defined by Calendar.

renderCellNotThisMonth

public function renderCellNotThisMonth(Date workingDate, HTMLTableCellElement 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:
  • workingDate : Date
    The current working Date object being used to generate the calendar
  • cell : HTMLTableCellElement
    The current working cell in the calendar
Returns:
  • String
    YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering should not be terminated
This method is defined by Calendar.

renderCellStyleHighlight1

public function renderCellStyleHighlight1(Date workingDate, HTMLTableCellElement cell)
Renders a single standard calendar cell using the CSS hightlight1 style
Parameters:
  • workingDate : Date
    The current working Date object being used to generate the calendar
  • cell : HTMLTableCellElement
    The current working cell in the calendar
Returns:
  • void
This method is defined by Calendar.

renderCellStyleHighlight2

public function renderCellStyleHighlight2(Date workingDate, HTMLTableCellElement cell)
Renders a single standard calendar cell using the CSS hightlight2 style
Parameters:
  • workingDate : Date
    The current working Date object being used to generate the calendar
  • cell : HTMLTableCellElement
    The current working cell in the calendar
Returns:
  • void
This method is defined by Calendar.

renderCellStyleHighlight3

public function renderCellStyleHighlight3(Date workingDate, HTMLTableCellElement cell)
Renders a single standard calendar cell using the CSS hightlight3 style
Parameters:
  • workingDate : Date
    The current working Date object being used to generate the calendar
  • cell : HTMLTableCellElement
    The current working cell in the calendar
Returns:
  • void
This method is defined by Calendar.

renderCellStyleHighlight4

public function renderCellStyleHighlight4(Date workingDate, HTMLTableCellElement cell)
Renders a single standard calendar cell using the CSS hightlight4 style
Parameters:
  • workingDate : Date
    The current working Date object being used to generate the calendar
  • cell : HTMLTableCellElement
    The current working cell in the calendar
Returns:
  • void
This method is defined by Calendar.

renderCellStyleSelected

public function renderCellStyleSelected(Date workingDate, HTMLTableCellElement cell)
Applies the default style used for rendering selected dates to the current calendar cell
Parameters:
  • workingDate : Date
    The current working Date object being used to generate the calendar
  • cell : HTMLTableCellElement
    The current working cell in the calendar
Returns:
  • String
    YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering should not be terminated
This method is defined by Calendar.

renderCellStyleToday

public function renderCellStyleToday(Date workingDate, HTMLTableCellElement cell)
Applies the default style used for rendering today's date to the current calendar cell
Parameters:
  • workingDate : Date
    The current working Date object being used to generate the calendar
  • cell : HTMLTableCellElement
    The current working cell in the calendar
Returns:
  • void
This method is defined by Calendar.

renderFooter

public function renderFooter(Array html)
Renders the calendar footer. In the default implementation, there is no footer.
Parameters:
  • html : Array
    The current working HTML array
Returns:
  • Array
    The current working HTML array
This method is defined by Calendar.

renderHeader

public function renderHeader(Array html)
Renders the calendar header.
Parameters:
  • html : Array
    The current working HTML array
Returns:
  • Array
    The current working HTML array
This method is defined by Calendar.

renderOutOfBoundsDate

public function renderOutOfBoundsDate(Date workingDate, HTMLTableCellElement cell)
Renders a cell that falls before the minimum date or after the maximum date. widget class.
Parameters:
  • workingDate : Date
    The current working Date object being used to generate the calendar
  • cell : HTMLTableCellElement
    The current working cell in the calendar
Returns:
  • String
    YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering should not be terminated
This method is defined by Calendar.

renderRowFooter

public function renderRowFooter(Number weekNum, Array cell)
Renders the row footer for a week.
Parameters:
  • weekNum : Number
    The week number of the current row
  • cell : Array
    The current working HTML array
Returns:
  • void
This method is defined by Calendar.

renderRowHeader

public function renderRowHeader(Number weekNum, Array cell)
Renders the row header for a week.
Parameters:
  • weekNum : Number
    The week number of the current row
  • cell : Array
    The current working HTML array
Returns:
  • void
This method is defined by Calendar.

reset

public function reset()
Resets the calendar widget to the originally selected month and year, and sets the calendar to the initial selection(s).
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

resetRenderers

public function resetRenderers()
Resets the render stack of the current calendar to its original pre-render value.
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

select

public function select(String/Date/Date[] 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.
This method is defined by Calendar.

selectCell

public function selectCell(Number 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.
This method is defined by Calendar.

setMonth

public function setMonth(Number month)
Sets the calendar's month explicitly
Parameters:
  • month : Number
    The numeric month, from 0 (January) to 11 (December)
Returns:
  • void
This method is defined by Calendar.

setYear

public function setYear(Number year)
Sets the calendar's year explicitly.
Parameters:
  • year : Number
    The numeric 4-digit year
Returns:
  • void
This method is defined by Calendar.

show

public function show()
Shows the Calendar's outer container.
Parameters:
  • None.
Returns:
  • void
This method is defined by Calendar.

styleCellDefault

public function styleCellDefault(Date workingDate, HTMLTableCellElement cell)
Styles a selectable cell.
Parameters:
  • workingDate : Date
    The current working Date object being used to generate the calendar
  • cell : HTMLTableCellElement
    The current working cell in the calendar
Returns:
  • void
This method is defined by Calendar.

subtractMonths

public function subtractMonths(Number 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
This method is defined by Calendar.

subtractYears

public function subtractYears(Number 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
This method is defined by Calendar.

toString

public function toString()
Returns a string representation of the object.
Parameters:
  • None.
Returns:
  • String
    A string representation of the Calendar object.
This method is defined by Calendar.

validate

public function validate()
Validates the calendar widget. This method has no default implementation and must be extended by subclassing the widget.
Parameters:
  • None.
Returns:
  • Should
    return true if the widget validates, and false if it doesn't.
This method is defined by Calendar.

Event Details

beforeDeselectEvent

public event beforeDeselectEvent
Fired before a selection is made
Subscribers will be called with the following parameters:
  • None.
This event is defined by Calendar.

beforeRenderEvent

public event beforeRenderEvent
Fired before the Calendar is rendered
Subscribers will be called with the following parameters:
  • None.
This event is defined by Calendar.

beforeSelectEvent

public event beforeSelectEvent
Fired before a selection is made
Subscribers will be called with the following parameters:
  • None.
This event is defined by Calendar.

changePageEvent

public event changePageEvent
Fired when the Calendar page is changed
Subscribers will be called with the following parameters:
  • None.
This event is defined by Calendar.

clearEvent

public event clearEvent
Fired when the Calendar is cleared
Subscribers will be called with the following parameters:
  • None.
This event is defined by Calendar.

deselectEvent

public event deselectEvent
Fired when a selection is made
Subscribers will be called with the following parameters:
  • Array : Array
    of Date field arrays in the format [YYYY, MM, DD].
This event is defined by Calendar.

renderEvent

public event renderEvent
Fired when the Calendar is rendered
Subscribers will be called with the following parameters:
  • None.
This event is defined by Calendar.

resetEvent

public event resetEvent
Fired when the Calendar is reset
Subscribers will be called with the following parameters:
  • None.
This event is defined by Calendar.

selectEvent

public event selectEvent
Fired when a selection is made
Subscribers will be called with the following parameters:
  • Array : Array
    of Date field arrays in the format [YYYY, MM, DD].
This event is defined by Calendar.

yui-ext - Copyright © 2006 Jack Slocum. | Yahoo! UI - Copyright © 2006 Yahoo! Inc.
All rights reserved.